/* ============================================
   Prompt 提示词编辑器 - Responsive Styles
   ============================================ */

/* ========== 移动端适配 (Mobile) ========== */

@media (max-width: 767px) {
  /* 重置所有容器的 padding */
  .app-container {
    min-height: 100vh;
    min-height: -webkit-fill-available;
  }

  /* Header 移动端优化 */
  .app-header {
    height: auto;
    min-height: 56px;
    padding: var(--space-3) var(--space-4);
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .header-left {
    flex: 1;
    min-width: 0;
  }

  .logo {
    font-size: var(--text-base);
    gap: var(--space-1);
  }

  .logo-icon {
    width: 24px;
    height: 24px;
  }

  .header-right {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .header-right select,
  .header-right button {
    height: 36px !important;
    padding: 0 var(--space-3) !important;
    font-size: var(--text-xs) !important;
    min-width: auto !important;
  }

  /* Main 内容区 */
  .app-main {
    grid-template-columns: 1fr;
    padding: var(--space-4);
    gap: var(--space-4);
  }

  /* 编辑器面板 */
  .editor-content {
    min-height: 350px;
    padding: var(--space-4);
  }

  /* 选项卡栏优化 */
  .tab-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 0;
    padding: var(--space-1);
  }

  .tab-bar::-webkit-scrollbar {
    display: none;
  }

  .tab-item {
    min-width: 70px;
    flex: 0 0 auto;
    height: 38px;
    padding: 0 var(--space-3);
    font-size: var(--text-xs);
    white-space: nowrap;
  }

  .tab-item .tab-icon {
    display: none; /* 移动端隐藏图标，节省空间 */
  }

  /* Tab Panel */
  .tab-panel {
    padding: 0;
  }

  /* 文本框优化 */
  .textarea {
    min-height: 150px;
    font-size: var(--text-sm);
    padding: var(--space-3);
  }

  .label-text {
    font-size: var(--text-sm);
  }

  .label-hint {
    font-size: var(--text-xs);
  }

  /* 预览面板 */
  .preview-panel {
    order: 2;
  }

  .editor-panel {
    order: 1;
  }

  .preview-container {
    padding: var(--space-4);
  }

  .preview-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-3);
  }

  .preview-title {
    font-size: var(--text-base);
  }

  .preview-actions {
    width: 100%;
  }

  .preview-actions .btn-primary {
    width: 100%;
    justify-content: center;
  }

  .preview-content {
    min-height: 250px;
    max-height: 350px;
    font-size: var(--text-xs);
    padding: var(--space-3);
  }

  /* 预览工具栏 */
  .preview-toolbar {
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
  }

  .preview-stats {
    width: 100%;
    justify-content: space-around;
    font-size: var(--text-xs);
  }

  .preview-actions-right {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    margin-left: 0;
  }

  .preview-actions-right button {
    width: 100%;
    justify-content: center;
  }

  /* Footer 移动端优化 */
  .app-footer {
    height: auto;
    min-height: 48px;
    padding: var(--space-2) var(--space-4);
    flex-direction: column;
    gap: var(--space-1);
  }

  .footer-left,
  .footer-center,
  .footer-right {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .footer-left {
    order: 1;
    font-size: var(--text-xs);
  }

  .footer-center {
    order: 2;
    font-size: var(--text-xs);
  }

  .footer-right {
    order: 3;
    justify-content: center;
  }

  /* 按钮尺寸 */
  .btn-primary,
  .btn-secondary {
    height: 36px;
    font-size: var(--text-xs);
    min-width: auto;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
  }

  /* Toast 优化 */
  .toast {
    left: var(--space-4);
    right: var(--space-4);
    transform: translateX(0) translateY(100px);
    font-size: var(--text-xs);
    padding: var(--space-2) var(--space-4);
  }

  .toast.show {
    transform: translateX(0) translateY(0);
  }
}

/* ========== 小屏幕手机 (Small Mobile) ========== */

@media (max-width: 375px) {
  .app-header {
    padding: var(--space-2);
  }

  .logo span:last-child {
    font-size: var(--text-sm);
  }

  .tab-item {
    min-width: 60px;
    height: 36px;
    padding: 0 var(--space-2);
    font-size: 10px;
  }

  .textarea {
    min-height: 120px;
    font-size: var(--text-xs);
  }

  .preview-content {
    min-height: 200px;
    font-size: 10px;
  }

  .preview-actions-right {
    grid-template-columns: 1fr;
  }

  .btn-primary,
  .btn-secondary {
    height: 34px;
    font-size: 10px;
  }
}

/* ========== 平板适配 (Tablet) ========== */

@media (min-width: 768px) and (max-width: 1023px) {
  .app-header {
    padding: 0 var(--space-6);
  }

  .app-main {
    grid-template-columns: 1fr 1fr;
    padding: var(--space-6);
    gap: var(--space-6);
  }

  .app-footer {
    padding: 0 var(--space-6);
  }

  .tab-item {
    height: 40px;
    font-size: var(--text-xs);
  }

  .editor-content {
    min-height: 400px;
    padding: var(--space-5);
  }

  .textarea {
    min-height: 180px;
  }

  .preview-content {
    min-height: 300px;
    max-height: 450px;
  }
}

/* ========== 大屏优化 ========== */

@media (min-width: 1536px) {
  .app-main {
    max-width: 1600px;
    gap: var(--space-12);
  }

  .textarea {
    min-height: 300px;
  }

  .preview-content {
    min-height: 500px;
    max-height: 700px;
  }
}

/* ========== 横屏模式 (Landscape) ========== */

@media (max-width: 767px) and (orientation: landscape) {
  .app-main {
    grid-template-columns: 1fr 1fr;
  }

  .preview-panel {
    order: 1;
  }

  .editor-panel {
    order: 2;
  }

  .editor-content {
    min-height: 200px;
  }

  .preview-content {
    min-height: 150px;
    max-height: 250px;
  }
}

/* ========== 触摸设备优化 ========== */

@media (hover: none) and (pointer: coarse) {
  /* 增大触摸目标 */
  .tab-item {
    min-height: 44px;
  }

  .btn-primary,
  .btn-secondary,
  .btn-icon {
    min-height: 44px;
  }

  /* 移除 hover 效果，防止触摸设备上的"粘滞" */
  .btn-primary:hover,
  .btn-secondary:hover,
  .btn-icon:hover,
  .tab-item:hover {
    transform: none;
  }

  /* 使用 active 状态替代 */
  .btn-primary:active {
    transform: scale(0.98);
  }

  .btn-secondary:active,
  .btn-icon:active {
    background-color: var(--bg-tertiary);
  }
}

/* ========== 打印样式 ========== */

@media print {
  .app-header,
  .app-footer,
  .tab-bar,
  .preview-actions,
  .preview-actions-right,
  .char-count {
    display: none;
  }

  .app-main {
    display: block;
  }

  .editor-panel {
    display: none;
  }

  .preview-panel {
    display: block;
  }

  .preview-container {
    box-shadow: none;
    border: none;
    padding: 0;
  }
}
