:root {
  --bg: #0b0c10;
  --panel: #111318;
  --card: #141821;
  --text: #e7ecf3;
  --muted: #9aa3b2;
  --primary: #5aa9e6;
  --primary-700: #3f8ed1;
  --border: #242a36;
  --accent: #8bc34a;
  --danger: #ff5c5c;
}

[data-theme="light"] {
  --bg: #ffffff;
  --panel: #f8f9fa;
  --card: #ffffff;
  --text: #212529;
  --muted: #6c757d;
  --primary: #007bff;
  --primary-700: #0056b3;
  --border: #dee2e6;
  --accent: #28a745;
  --danger: #dc3545;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
  background: radial-gradient(1200px 600px at 20% -10%, #1a2030 0%, #0b0c10 40%), var(--bg);
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

.app-header {
  border-bottom: 1px solid var(--border);
  background: rgba(10,12,18,0.7);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="light"] .app-header {
  background: rgba(248,249,250,0.9);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
  position: relative;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand .logo {
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 18px;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

.brand .logo:hover {
  opacity: 0.8;
}
.brand .subtitle { color: var(--muted); font-size: 12px; }
.links { display: flex; align-items: center; }
.links a { color: var(--muted); text-decoration: none; margin-left: 14px; }
.links a:hover { color: var(--text); }
.btn-theme {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: 14px;
  border-radius: 4px;
  transition: all 0.3s ease;
}
.btn-theme:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}
[data-theme="light"] .btn-theme:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* Burger Menu */
.burger-menu {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 10px;
  background: none;
  border: none;
  z-index: 100;
}

@media (min-width: 841px) {
  .links {
    display: flex !important;
  }
}

.burger-menu span {
  display: block;
  width: 28px;
  height: 3px;
  background: var(--text);
  transition: all 0.3s ease;
  border-radius: 2px;
}

.burger-menu.active span:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

.burger-menu.active span:nth-child(2) {
  opacity: 0;
}

.burger-menu.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

@media (max-width: 840px) {
  .header-inner {
    padding: 36px 0;
  }

  .brand .subtitle {
    display: none;
  }

  .brand .logo {
    font-size: 20px;
  }

  .burger-menu {
    display: flex;
  }

  .app-header {
    position: relative;
  }

  .links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 99;
  }

  .links.active {
    max-height: 500px;
    overflow-y: auto;
  }

  .links a {
    margin: 0;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: block;
  }

  .links a:hover {
    background: var(--card);
  }

  .links a.active {
    background: rgba(90, 169, 230, 0.1);
  }

  .btn-theme {
    margin: 0;
    padding: 16px 20px;
    text-align: left;
    border-radius: 0;
  }
}

.app-main { display: grid; gap: 18px; padding: 20px 0 36px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

/* override panel styling on index page */
.page-index .panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.switch input { vertical-align: middle; }

.text-input, .text-output {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 12px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}
.text-input:focus, .text-output:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(90,169,230,0.15); }

.toolbar { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.toolbar .left { display: flex; gap: 8px; }

.btn {
  appearance: none;
  border: 1px solid var(--primary-700);
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-700) 100%);
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-small { padding: 6px 10px; font-size: 12px; }

.outputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }

.translate { margin-top: 14px; }
.translate-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.translate-controls label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

.app-footer { border-top: 1px solid var(--border); color: var(--muted); }
.app-footer .container { padding: 16px 0 28px; }

@media (max-width: 840px) {
  .outputs { grid-template-columns: 1fr; }
  
  body {
    font-size: 15px;
  }
  
  .container {
    padding: 12px 12px;
  }
  
  .panel {
    padding: 14px;
  }
  
  .card {
    padding: 10px;
  }
  
  .text-input, .text-output {
    min-height: 100px;
    font-size: 14px;
  }
  
  .btn {
    width: 100%;
    margin-bottom: 8px;
  }
  
  .translate-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .translate-controls label {
    width: 100%;
  }
  
  .translate-controls select {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 8px;
  }
  
  .panel {
    padding: 12px;
  }
  
  .card {
    padding: 8px;
  }
  
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .panel-head h2 {
    font-size: 20px;
    margin-bottom: 12px;
  }
  
  .demo-flip-controls {
    width: 100%;
    justify-content: flex-start;
  }
  
  .flip-btn {
    padding: 8px 12px;
    font-size: 13px;
    flex: 1;
    min-width: 0;
  }
  
  .demo-textarea, .demo-result {
    font-size: 14px !important;
    min-height: 120px !important;
  }
  
  textarea.demo-textarea {
    padding: 10px;
  }
}

/* Bookmarks page styles */
.bookmarks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.bookmark-category {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.bookmark-category h3 {
  color: var(--primary);
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 600;
}

.phrases-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phrase-item {
  padding: 12px;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

.phrase-item:hover {
  border-color: var(--primary);
}

.phrase-item .georgian {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.phrase-item .transliteration {
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 2px;
}

.phrase-item .english {
  font-size: 14px;
  color: var(--text);
}

.links .active {
  color: var(--primary);
  font-weight: 600;
}

/* Transliteration page styles */
.transliteration-content {
  margin-top: 20px;
}

.guide-section {
  margin-bottom: 32px;
}

.guide-section h3 {
  color: var(--primary);
  margin-bottom: 16px;
  font-size: 20px;
  font-weight: 600;
}

.guide-section p {
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 16px;
}

.usage-example, .example-pair {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 16px 0;
}

.input-text {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  color: var(--muted);
  background: var(--panel);
  padding: 4px 8px;
  border-radius: 4px;
}

.output-text {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  color: var(--text);
  background: var(--panel);
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.arrow {
  color: var(--primary);
  font-size: 18px;
  font-weight: bold;
}

.meaning {
  color: var(--muted);
  font-style: italic;
  font-size: 14px;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.rule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Courier New', monospace;
}

.rule-item .latin {
  color: var(--muted);
  font-size: 16px;
}

.rule-item .georgian {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
}

.examples-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note {
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 8px;
  padding: 12px;
  margin: 16px 0;
}

.note strong {
  color: var(--accent);
}

.tips-list {
  list-style-type: disc;
  padding-left: 20px;
  color: var(--text);
  line-height: 1.6;
}

.tips-list li {
  margin-bottom: 8px;
}

/* Translation page styles */
.translation-content {
  margin-top: 20px;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 24px 0;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

.step-content h4 {
  color: var(--text);
  margin-bottom: 8px;
  font-size: 16px;
}

.step-content p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.languages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.language-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.flag {
  font-size: 24px;
}

.lang-info {
  flex: 1;
}

.lang-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.lang-code {
  font-size: 12px;
  color: var(--muted);
  font-family: 'Courier New', monospace;
}

.translation-example {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
}

.georgian-text {
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
  flex: 1;
}

.translated-text {
  font-size: 16px;
  color: var(--text);
  flex: 1;
}

.lang-label {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  flex-shrink: 0;
}

/* Feature Demo Section */
.feature-demo {
  margin-bottom: 24px;
}

.demo-flip-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.flip-btn {
  padding: 8px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.flip-btn:hover {
  background: var(--card);
  color: var(--text);
}

.flip-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.demo-input-large {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--border);
}


.demo-textarea {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  width: 100%;
  min-height: 80px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}

.demo-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(90, 169, 230, 0.1);
}

.demo-result {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  width: 100%;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.demo-result.georgian {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}


.arrow {
  color: var(--primary);
  font-size: 24px;
  font-weight: bold;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .feature-demo {
    padding: 16px;
  }

  .demo-input-large {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .demo-textarea,
  .demo-result {
    min-height: 60px;
    font-size: 14px;
  }

  .demo-result.georgian {
    font-size: 16px;
  }

  .arrow {
    font-size: 20px;
  }
}

/* Hide input panel */
.input-panel {
  display: none;
}


