/* ============================================================================
   GeoVocab_Core — Professional Dark Theme with 3-Language Color Coding
   ============================================================================ */

:root {
  /* Color scheme */
  --accent-burmese: #00d9a3;
  --accent-japanese: #9f7aea;
  --accent-english: #4299e1;
  --bg-primary: #0f1419;
  --bg-secondary: #1a1f2b;
  --bg-tertiary: #232a3a;
  --text-primary: #e2e8f0;
  --text-secondary: #a0aec0;
  --text-muted: #718096;
  --border-color: #2d3748;
  --success: #48bb78;
  --warning: #ecc94b;
  --error: #f56565;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ============================================================================
   LAYOUT STRUCTURE - MOBILE FIRST
   ============================================================================ */

.app-container {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  gap: 0;
}

header.header {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-bottom: 2px solid var(--accent-burmese);
  padding: var(--spacing-md) var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex: 1;
}

header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent-english), var(--accent-burmese));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-stats {
  display: none;
  gap: var(--spacing-lg);
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-burmese);
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: var(--spacing-xs);
}

/* MOBILE HAMBURGER MENU */
.hamburger-btn {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--spacing-sm);
  width: 44px;
  height: 44px;
  justify-content: center;
  align-items: center;
  border-radius: var(--radius-md);
  transition: all 200ms ease;
}

.hamburger-btn:active {
  background: var(--bg-tertiary);
}

.hamburger-btn span {
  width: 24px;
  height: 2px;
  background: var(--accent-burmese);
  border-radius: 1px;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

.hamburger-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(10px, 10px);
}

.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}

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

/* MOBILE SIDEBAR */
aside.sidebar {
  position: fixed;
  left: 0;
  top: 80px;
  width: 100%;
  height: calc(100vh - 80px);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: var(--spacing-lg);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 99;
  padding-bottom: var(--spacing-xl);
}

aside.sidebar.active {
  transform: translateX(0);
  box-shadow: 2px 0 16px rgba(0, 217, 163, 0.2);
}

.sidebar-section {
  margin-bottom: var(--spacing-xl);
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-burmese);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
}

.sidebar-btn {
  display: block;
  width: 100%;
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  transition: all 200ms ease;
  text-align: left;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.sidebar-btn:active {
  background: var(--bg-tertiary);
  border-color: var(--accent-burmese);
  transform: scale(0.98);
}

.sidebar-btn.active {
  background: linear-gradient(135deg, var(--accent-burmese), #00c890);
  color: var(--bg-primary);
  border-color: var(--accent-burmese);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 217, 163, 0.3);
}

main.main-content {
  grid-row: 2;
  padding: var(--spacing-md);
  overflow-y: auto;
  max-height: auto;
}

/* ============================================================================
   VOCABULARY CARDS - MOBILE FIRST
   ============================================================================ */

.vocab-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
}

.vocab-card {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  cursor: pointer;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  active-color: var(--accent-burmese);
}

.vocab-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-english), var(--accent-japanese), var(--accent-burmese));
  opacity: 0.5;
  transition: opacity 200ms ease;
}

.vocab-card:active {
  transform: scale(0.95);
  border-color: var(--accent-burmese);
  box-shadow: 0 8px 20px rgba(0, 217, 163, 0.25);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-md);
  gap: var(--spacing-md);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.card-badges {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-category {
  background: linear-gradient(135deg, var(--accent-english), #2563eb);
  color: white;
}

.badge-verified {
  background: rgba(72, 187, 120, 0.2);
  color: var(--success);
  border: 1px solid var(--success);
}

.badge-review {
  background: rgba(236, 201, 75, 0.2);
  color: var(--warning);
  border: 1px solid var(--warning);
}

.card-formula {
  background: var(--bg-tertiary);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--accent-english);
  margin-bottom: var(--spacing-md);
  border-left: 3px solid var(--accent-english);
  overflow-x: auto;
}

.card-translations {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-top: auto;
}

.card-translations div {
  font-size: 13px;
  line-height: 1.4;
  padding: var(--spacing-sm) 0;
}

/* ============================================================================
   MODALS
   ============================================================================ */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  animation: fadeIn 200ms ease;
  overflow-y: auto;
  padding: var(--spacing-md) 0;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  max-width: 100%;
  width: calc(100% - var(--spacing-md));
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 300ms cubic-bezier(0.4, 0, 0.2, 1);
  margin: var(--spacing-md);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
  gap: var(--spacing-md);
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 700;
  flex: 1;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 24px;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: all 200ms ease;
  flex-shrink: 0;
}

.modal-close:active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ============================================================================
   FORMS
   ============================================================================ */

.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  color: var(--text-primary);
}

.form-input,
.form-textarea,
.form-select {
  display: block;
  width: 100%;
  padding: var(--spacing-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
  caret-color: var(--accent-burmese);
  font-family: inherit;
  font-size: 14px;
  transition: all 200ms ease;
  min-height: 44px;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-burmese);
  box-shadow: 0 0 0 3px rgba(0, 217, 163, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
  display: inline-block;
  padding: var(--spacing-md) var(--spacing-lg);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-burmese), #00c890);
  color: var(--bg-primary);
  box-shadow: 0 4px 12px rgba(0, 217, 163, 0.3);
}

.btn-primary:active {
  background: linear-gradient(135deg, #00c890, var(--accent-burmese));
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:active {
  background: var(--border-color);
  border-color: var(--text-secondary);
}

.btn-small {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 12px;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
}

/* ============================================================================
   RESPONSIVE DESIGN - TABLET & DESKTOP (768px+)
   ============================================================================ */

@media (min-width: 768px) {
  .app-container {
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
  }

  header.header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
  }

  .hamburger-btn {
    display: none;
  }

  .header-stats {
    display: flex;
  }

  header h1 {
    font-size: 28px;
  }

  .stat-label {
    font-size: 12px;
  }

  aside.sidebar {
    position: static;
    grid-row: 2;
    width: auto;
    height: auto;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    border-bottom: none;
    padding: var(--spacing-lg);
    overflow: visible;
    transform: translateX(0) !important;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    z-index: auto;
  }

  .sidebar-section {
    margin-bottom: var(--spacing-xl);
  }

  .sidebar-btn {
    background: transparent;
    border: 1px solid var(--border-color);
  }

  .sidebar-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent-burmese);
  }

  .sidebar-btn:active {
    transform: none;
  }

  .vocab-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--spacing-lg);
  }

  main.main-content {
    padding: var(--spacing-xl);
    max-height: calc(100vh - 80px);
  }

  .modal-content {
    width: 90vw;
    max-width: 860px;
  }

  .btn-group {
    flex-direction: row;
  }

  .btn {
    flex: 1;
  }
}

/* ============================================================================
   SEARCH INPUT - MOBILE
   ============================================================================ */

.form-input[placeholder*="Search"],
#vocabSearch {
  font-size: 16px;
  padding: var(--spacing-md) var(--spacing-lg);
  width: 100%;
  margin-bottom: var(--spacing-md);
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  transition: all 200ms ease;
}

.form-input[placeholder*="Search"]:focus,
#vocabSearch:focus {
  border-color: var(--accent-burmese);
  background: var(--bg-tertiary);
  box-shadow: 0 0 0 3px rgba(0, 217, 163, 0.1);
}

/* ============================================================================
   ACCESSIBILITY & TOUCH TARGETS
   ============================================================================ */

@media (max-width: 768px) {
  button, a[role="button"] {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
