/**
 * MeetLingo UI v2 — mobil + web görsel iyileştirmeler
 */

:root {
  --ui-gradient: linear-gradient(135deg, #3b82f6 0%, #6366f1 50%, #8b5cf6 100%);
  --ui-glow: 0 0 40px rgba(99, 102, 241, 0.15);
  --ui-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Workspace hero card ─── */
.workspace-card {
  position: relative;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.08)) border-box;
  box-shadow: var(--shadow-card), var(--ui-glow);
}

@media (min-width: 769px) {
  .main {
    grid-template-columns: 1fr minmax(300px, 340px);
    gap: 1.25rem;
  }

  .content-column {
    min-width: 0;
  }

  .translation-display {
    min-height: 160px;
    padding: 0.75rem 0 1rem;
  }

  .translation-target {
    font-size: var(--font-size-tr);
    line-height: 1.25;
    background: linear-gradient(180deg, #fef3c7 0%, var(--tr-color) 45%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .translation-target:not(:empty) {
    filter: drop-shadow(0 2px 12px rgba(251, 191, 36, 0.2));
  }

  .coach-panel {
    border-top: 1px solid rgba(148, 163, 184, 0.08);
  }

  .coach-answers {
    display: grid;
    gap: 0.65rem;
  }

  @media (min-width: 1100px) {
    .coach-answers {
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
  }
}

/* Translation labels */
.translation-display {
  gap: 0.35rem;
}

.display-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  opacity: 0.85;
}

.display-label.target-label {
  color: #fbbf24;
  opacity: 1;
  margin-top: 0.5rem;
}

.interim-source:not(:empty) {
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border-left: 3px solid rgba(148, 163, 184, 0.3);
  font-style: italic;
}

/* ─── Desktop sidebar tabs ─── */
@media (min-width: 769px) {
  .sidebar-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.3rem;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 1rem;
  }

  .tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.55rem 0.25rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1.2;
    transition: var(--ui-transition);
  }

  .tab-btn .tab-icon {
    font-size: 1.05rem;
    line-height: 1;
    opacity: 0.75;
    transition: var(--ui-transition);
  }

  .tab-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
  }

  .tab-btn.active {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
  }

  .tab-btn.active .tab-icon {
    opacity: 1;
    transform: scale(1.08);
  }

  .control-card {
    border-radius: 14px;
    transition: border-color var(--ui-transition), box-shadow var(--ui-transition);
  }

  .control-card:hover {
    border-color: rgba(148, 163, 184, 0.18);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }

  .profile-card .profile-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--ui-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
  }

  .profile-meta strong {
    display: block;
    font-size: 0.92rem;
    margin-bottom: 0.15rem;
  }

  .profile-meta span {
    font-size: 0.75rem;
    color: var(--text-muted);
  }

  .profile-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    margin: 0.4rem 0 0.25rem;
    overflow: hidden;
  }

  .profile-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--ui-gradient);
    transition: width 0.4s ease;
  }

  .profile-stat {
    font-size: 0.68rem;
    color: var(--text-muted);
  }
}

/* Coach answer cards */
.coach-answer {
  border-radius: 12px;
  transition: transform var(--ui-transition), box-shadow var(--ui-transition);
}

@media (min-width: 769px) {
  .coach-answer:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  }
}

.coach-empty-state {
  text-align: center;
  padding: 1.5rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border);
}

.coach-empty-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

/* ─── Mobile source segmented control ─── */
@media (max-width: 768px) {
  .mobile-source-bar {
    display: flex;
    gap: 0;
    padding: 0.25rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-top: 0.65rem;
  }

  .source-chip {
    flex: 1;
    margin: 0;
  }

  .source-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }

  .source-chip span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 0.5rem;
    border-radius: 9px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--ui-transition);
    cursor: pointer;
  }

  .source-chip:has(input:checked) span {
    background: var(--ui-gradient);
    color: #fff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
  }

  .translation-target {
    font-size: clamp(1.4rem, 6vw, 1.85rem);
    line-height: 1.3;
    padding: 0.25rem 0;
  }

  .workspace-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
  }

  .translation-panel {
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: auto;
  }

  .coach-panel {
    flex: 1;
    min-height: 120px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Bottom nav — pill indicator */
  .mobile-bottom-nav {
    padding: 0 0.35rem;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  }

  .mob-nav-btn {
    position: relative;
    padding-top: 0.45rem;
    padding-bottom: 0.3rem;
  }

  .mob-nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 28px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--ui-gradient);
    transition: transform var(--ui-transition);
  }

  .mob-nav-btn.active::before {
    transform: translateX(-50%) scaleX(1);
  }

  .mob-nav-btn.active svg {
    color: #93c5fd;
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.5));
  }

  /* Footer action bar */
  .action-bar-inner {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
  }

  .btn-listen.listening {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.45) !important;
    animation: listenPulseMob 1.5s ease-in-out infinite;
  }

  @keyframes listenPulseMob {
    0%, 100% { box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 6px 28px rgba(239, 68, 68, 0.6); }
  }

  /* Tab overlay panels */
  .tab-panel.active {
    animation: panelSlideIn 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  @keyframes panelSlideIn {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .mob-panel-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg);
    padding-top: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .control-card {
    border-radius: 14px;
  }

  .header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: linear-gradient(to bottom, var(--bg) 85%, transparent);
    padding-bottom: 0.35rem;
  }
}

/* ─── Web header refinement ─── */
@media (min-width: 769px) {
  .header {
    padding: 0.25rem 0 0.5rem;
  }

  .glass-panel.lang-bar {
    flex: 1;
    max-width: 680px;
    margin-left: auto;
  }

  .action-bar {
    position: relative;
    z-index: 5;
  }
}

/* Timeline polish */
.timeline-item {
  transition: background var(--ui-transition);
}

.timeline-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Toast upgrade */
.toast {
  font-weight: 500;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.toast-success {
  border-left: 3px solid #22c55e;
}

.toast-error {
  border-left: 3px solid #ef4444;
}

.toast-info {
  border-left: 3px solid #3b82f6;
}

/* Footer dedication — Ahmet → Menar */
.footer-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.footer-dedication {
  margin: 0;
  padding: 0 0.75rem 0.15rem;
  font-size: 0.72rem;
  line-height: 1.45;
  letter-spacing: 0.01em;
  text-align: center;
  color: rgba(251, 191, 193, 0.82);
  font-weight: 500;
}

.footer-dedication [lang="th"] {
  font-family: "Plus Jakarta Sans", "Noto Sans Thai", "Leelawadee UI", sans-serif;
}

.dedication-heart {
  display: inline-block;
  margin-right: 0.35rem;
  color: #f472b6;
  font-size: 0.65rem;
  vertical-align: middle;
  animation: dedicationPulse 2.8s ease-in-out infinite;
}

@keyframes dedicationPulse {
  0%, 100% { opacity: 0.75; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); }
}

body.embed-mode .footer-dedication {
  display: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  .footer-dedication {
    font-size: 0.65rem;
    padding-bottom: 0.05rem;
  }

  .mob-nav-btn span {
    font-size: 0.58rem;
  }

  .mob-nav-btn svg {
    width: 18px;
    height: 18px;
  }
}
