/* ========================================
   TRANSLATE.LK — Main Stylesheet
   ======================================== */

:root {
  --primary: #f97316;       /* orange */
  --primary-dark: #ea6100;
  --secondary: #1d6fdb;     /* blue */
  --secondary-dark: #1558b0;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface2: #f0f4ff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.14);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 64px;
  --font-display: 'Baloo 2', cursive;
  --font-body: 'Nunito', sans-serif;
  --transition: .22s cubic-bezier(.4,0,.2,1);
}

/* DARK MODE */
body.dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #162032;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
textarea { font-family: var(--font-body); resize: none; outline: none; border: none; background: transparent; }

/* ========================================
   HEADER
   ======================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-link { display: flex; align-items: center; flex-shrink: 0; }
.logo-img { height: 38px; width: auto; object-fit: contain; }

.header-nav {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: .88rem;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.nav-link:hover, .nav-link.active {
  background: var(--surface2);
  color: var(--secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dark-toggle {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.dark-toggle:hover { background: var(--border); color: var(--primary); }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 38px; height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface2);
}
.hamburger span {
  display: block;
  width: 18px; height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: var(--transition);
}

.mobile-nav {
  display: none;
  flex-direction: column;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  gap: 4px;
}
.mobile-nav.open { display: flex; }
.mobile-nav-link {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.mobile-nav-link:hover { background: var(--surface2); color: var(--secondary); }

/* ========================================
   HERO STRIP
   ======================================== */
.hero-strip {
  background: linear-gradient(135deg, #1d6fdb 0%, #0f4ba0 60%, #0a3470 100%);
  color: #fff;
  padding: 36px 20px;
  position: relative;
  overflow: hidden;
}
.hero-strip::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  position: relative;
}
.hero-text h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -.5px;
}
.hero-text p {
  font-size: .95rem;
  opacity: .85;
  margin-top: 4px;
}
.hero-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.badge {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: .85rem;
}

/* ========================================
   MAIN
   ======================================== */
.main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

/* ========================================
   TRANSLATOR CARD
   ======================================== */
.translator-card {
  display: grid;
  grid-template-columns: 1fr 52px 1fr;
  gap: 0;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: visible;
  transition: background var(--transition), border-color var(--transition);
}

/* PANEL */
.panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-panel {
  border-right: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius);
}
.output-panel {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.panel-label {
  font-family: var(--font-display);
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

/* DROPDOWN */
.dropdown-container { position: relative; }
.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px 6px 10px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  transition: background var(--transition), border-color var(--transition);
  cursor: pointer;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
}
.dropdown-toggle:hover { background: var(--border); }
.dropdown-toggle ion-icon { font-size: 1rem; color: var(--text-muted); flex-shrink: 0; }
.dropdown-toggle .selected { overflow: hidden; text-overflow: ellipsis; }
.chevron { transition: transform var(--transition); }
.dropdown-container.active .chevron { transform: rotate(180deg); }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  list-style: none;
  padding: 6px;
}
.dropdown-container.active .dropdown-menu { display: block; }
.dropdown-menu .option {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: .88rem;
  cursor: pointer;
  transition: background var(--transition);
  color: var(--text);
}
.dropdown-menu .option:hover { background: var(--surface2); }
.dropdown-menu .option.active { background: var(--surface2); color: var(--secondary); font-weight: 700; }

/* Scrollbar for dropdown */
.dropdown-menu::-webkit-scrollbar { width: 4px; }
.dropdown-menu::-webkit-scrollbar-track { background: transparent; }
.dropdown-menu::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* TEXTAREA */
.textarea-wrap { position: relative; flex: 1; }
.textarea-wrap textarea {
  width: 100%;
  height: 180px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color var(--transition), background var(--transition);
}
.textarea-wrap textarea:focus { border-color: var(--secondary); }
.output-panel .textarea-wrap textarea { color: var(--secondary); font-weight: 600; }

.char-count {
  position: absolute;
  bottom: 10px; right: 12px;
  font-size: .75rem;
  color: var(--text-light);
}

.translating-indicator {
  display: none;
  position: absolute;
  bottom: 12px; left: 14px;
  gap: 4px;
}
.translating-indicator.show { display: flex; }
.dot {
  width: 7px; height: 7px;
  background: var(--secondary);
  border-radius: 50%;
  animation: bounce .8s infinite ease-in-out;
}
.dot:nth-child(2) { animation-delay: .15s; }
.dot:nth-child(3) { animation-delay: .3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* PANEL FOOTER */
.panel-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: background var(--transition), color var(--transition), transform .1s;
}
.action-btn:hover { background: var(--border); color: var(--text); transform: translateY(-1px); }
.action-btn ion-icon { font-size: 1rem; }
.upload-label { cursor: pointer; }

.primary-btn {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
  margin-left: auto;
}
.primary-btn:hover { background: var(--primary-dark) !important; border-color: var(--primary-dark) !important; }

/* ========================================
   SWAP COLUMN
   ======================================== */
.swap-col {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 5;
}
.swap-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  color: var(--secondary);
  box-shadow: var(--shadow-md);
  transition: background var(--transition), color var(--transition), transform var(--transition), border-color var(--transition);
}
.swap-btn:hover { background: var(--secondary); color: #fff; border-color: var(--secondary); transform: rotate(180deg); }

/* ========================================
   QUICK LANGUAGE PILLS
   ======================================== */
.quick-langs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.ql-label {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}
.ql-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .83rem;
  font-weight: 700;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.ql-pill:hover, .ql-pill.active {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}

/* ========================================
   FEATURES SECTION
   ======================================== */
.features-section { margin-top: 60px; }
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 32px;
  color: var(--text);
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  transition: transform .2s, box-shadow .2s, background var(--transition);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature-icon { font-size: 2.2rem; margin-bottom: 12px; }
.feature-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.feature-card p { font-size: .88rem; color: var(--text-muted); line-height: 1.5; }

/* ========================================
   FOOTER
   ======================================== */
.footer {
  background: #0f172a;
  color: #94a3b8;
  margin-top: auto;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 20px 32px;
  display: grid;
  grid-template-columns: 1.5fr 2fr;
  gap: 48px;
}
.footer-logo { height: 32px; width: auto; object-fit: contain; filter: brightness(1.2); margin-bottom: 12px; }
.footer-tagline { font-size: .88rem; line-height: 1.6; max-width: 240px; }

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.footer-col h4 {
  font-family: var(--font-display);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #e2e8f0;
  margin-bottom: 12px;
}
.footer-col a {
  display: block;
  font-size: .88rem;
  color: #64748b;
  padding: 3px 0;
  transition: color var(--transition);
}
.footer-col a:hover { color: var(--primary); }

.footer-bottom {
  border-top: 1px solid #1e293b;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  flex-wrap: wrap;
  gap: 8px;
}

/* ========================================
   TOAST
   ======================================== */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: #1e293b;
  color: #f1f5f9;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ========================================
   RESPONSIVE — TABLET
   ======================================== */
@media (max-width: 900px) {
  .header-nav { display: none; }
  .hamburger { display: flex; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr; gap: 32px; }
  .footer-links { grid-template-columns: repeat(3, 1fr); }
}

/* ========================================
   RESPONSIVE — MOBILE
   ======================================== */
@media (max-width: 640px) {
  .translator-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .input-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .output-panel {
    border-radius: 0 0 var(--radius) var(--radius);
  }

  .swap-col {
    padding: 12px 0;
    background: var(--surface);
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .swap-btn:hover { transform: rotate(90deg); }

  .hero-inner { flex-direction: column; gap: 12px; }
  .hero-badges { justify-content: flex-start; }

  .features-grid { grid-template-columns: 1fr; gap: 14px; }
  .feature-card { display: flex; align-items: flex-start; text-align: left; gap: 16px; }
  .feature-icon { font-size: 1.8rem; flex-shrink: 0; }

  .footer-links { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }

  .panel { padding: 16px; }
  .textarea-wrap textarea { height: 140px; }

  .panel-footer { gap: 6px; }
  .action-btn { padding: 6px 10px; font-size: .78rem; }

  .quick-langs { gap: 6px; margin-top: 14px; }
  .ql-pill { padding: 5px 11px; font-size: .78rem; }

  .dropdown-toggle { max-width: 160px; }
}