﻿/* ============================================================
   codec.css - 编码转换页面样式 (移动优先·精简版)
   ============================================================ */

/* ---------- Page Header ---------- */
.codec-header {
  text-align: center;
  padding: 10px 0 4px;
}
@media (max-width: 768px) {
  .codec-header { padding-top: 30px; }
}
@media (max-width: 480px) {
  .codec-header { padding-top: 70px; }
}
.codec-header h1 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.5rem;
  color: #2c3e50;
}
.codec-header h1 svg { width: 24px; height: 24px; flex-shrink: 0; }
.codec-header p { margin-top: 4px; font-size: 0.82rem; }

/* ---------- I/O Panels ---------- */
.codec-io {
  margin-top: 12px;
}

.codec-panel {
  background: #fff;
  border: 1px solid #dde4ed;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.codec-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #f5f7fa;
  border-bottom: 1px solid #dde4ed;
  gap: 6px;
  font-size: 0.82rem;
}
.codec-panel-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: #5a6c7d;
  font-size: 0.82rem;
}
.codec-panel-label svg { width: 16px; height: 16px; color: #7c3aed; }
.codec-result-label {
  font-weight: 400;
  font-size: 0.72rem;
  color: #27ae60;
  margin-left: 2px;
}
.codec-result-label::before {
  content: "·";
  margin-right: 4px;
  color: #8a9baa;
}
.codec-panel-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}
.codec-char-count {
  font-size: 0.7rem;
  color: #8a9baa;
  margin-left: 4px;
  white-space: nowrap;
}

.codec-textarea {
  display: block;
  width: 100%;
  min-height: 110px;
  max-height: 250px;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 12px 14px;
  font-size: 0.88rem;
  font-family: "SF Mono","Consolas","Monaco","Courier New",monospace;
  line-height: 1.6;
  resize: vertical;
  background: #fff;
  color: #2c3e50;
  outline: none;
}
.codec-textarea::placeholder { color: #b0bec5; }
.codec-textarea:focus { background: #fafbfc; }
.codec-textarea[readonly] { cursor: default; background: #fafbfc; }

/* ---------- Detect Bar ---------- */
.codec-detect-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(74,144,217,0.05), rgba(95,184,255,0.05));
  border: 1px solid rgba(74,144,217,0.15);
  border-radius: 10px;
}
.codec-detect-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.82rem;
}
.codec-detect-info strong { color: #2c3e50; white-space: nowrap; }
.codec-detect-info span { color: #8a9baa; font-size: 0.73rem; }
.codec-detect-recommend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(74,144,217,0.35);
  animation: codec-pulse 2s ease-in-out infinite;
  transition: all 0.2s;
}
.codec-detect-recommend:hover { background: #6d28d9; transform: translateY(-1px); }
.codec-detect-recommend svg { width: 14px; height: 14px; }
@keyframes codec-pulse {
  0%,100% { box-shadow: 0 2px 10px rgba(74,144,217,0.35); }
  50% { box-shadow: 0 2px 20px rgba(74,144,217,0.5); }
}

/* ---------- Quick Actions ---------- */
.codec-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  justify-content: center;
}
.codec-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 15px;
  background: #fff;
  color: #7c3aed;
  border: 1.5px solid #d0e0f5;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.codec-quick-btn:hover { background: #eef6ff; border-color: #7c3aed; }
.codec-quick-btn:active { transform: scale(0.96); background: #dceeff; }
.codec-quick-btn.recommended {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
  box-shadow: 0 2px 10px rgba(74,144,217,0.35);
  animation: codec-pulse 2s ease-in-out infinite;
}
.codec-quick-btn.recommended:hover { background: #6d28d9; border-color: #6d28d9; }

.codec-swap-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 4px 0;
}
.codec-swap-inline button {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid #dde4ed;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a6c7d;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.codec-swap-inline button:hover { border-color: #7c3aed; color: #7c3aed; transform: rotate(180deg); }
.codec-swap-inline button svg { width: 18px; height: 18px; }

/* ---------- Expand: More Tools ---------- */
.codec-more-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  margin-top: 14px;
  background: #fff;
  border: 1px dashed #d0e0f5;
  border-radius: 12px;
  color: #7c3aed;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.codec-more-toggle:hover { background: #f5faff; border-style: solid; }
.codec-more-toggle svg { width: 18px; height: 18px; transition: transform 0.25s; }
.codec-more-toggle.open svg { transform: rotate(180deg); }

.codec-more-panel { display: none; margin-top: 12px; }
.codec-more-panel.open { display: block; }

/* Tool Group */
.codec-tool-group {
  background: #fff;
  border: 1px solid #dde4ed;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}
.codec-tool-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: #f5f7fa;
  font-weight: 600;
  font-size: 0.8rem;
  color: #5a6c7d;
  border-bottom: 1px solid #dde4ed;
}
.codec-tool-group-title svg { width: 16px; height: 16px; color: #7c3aed; }
.codec-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 1px;
  background: #dde4ed;
}
.codec-tool-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 9px 12px;
  background: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  font-family: inherit;
  color: #2c3e50;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}
.codec-tool-btn:hover { background: #f0f7ff; color: #7c3aed; }
.codec-tool-btn:active { transform: scale(0.97); }
.codec-tool-btn.recommended {
  background: #e8f4ff;
  color: #2c64a0;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px #7c3aed;
  z-index: 1;
}
.codec-tool-btn .tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 5px;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: "SF Mono","Consolas",monospace;
  background: rgba(74,144,217,0.08);
  color: #7c3aed;
  flex-shrink: 0;
}

/* ---- Mobile: hide desktop swap ---- */
.codec-col-mid { display: none; }

/* ---------- Desktop Tweaks (>=769px) ---------- */
@media (min-width: 769px) {
  .codec-header { padding: 20px 0 8px; }
  .codec-header h1 { font-size: 1.7rem; }
  .codec-io { display: flex; gap: 12px; align-items: flex-start; }
  .codec-io > .codec-col-input  { flex: 1 1 45%; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
  .codec-io > .codec-col-output { flex: 1 1 45%; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
  .codec-io > .codec-col-mid {
    flex: 0 0 auto;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    padding-top: 48px;
  }
  .codec-swap-inline#swapMobile { display: none !important; }
  .codec-textarea { min-height: 160px; max-height: 350px; }
  .codec-quick-actions { justify-content: flex-start; margin: 0; }
  .codec-detect-bar { margin: 8px 0; }
}
