/* CSS for Rajasthan Geography SPA Notes */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #182234;
  --bg-card-hover: #223046;
  --accent: #38bdf8;
  --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #3b82f6 100%);
  --accent-gold: #f59e0b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --success: #10b981;
  --warning: #f59e0b;
  --sidebar-width: 320px;
  --header-height: 70px;
  --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  height: var(--header-height);
  background-color: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  display: none;
  padding: 4px 8px;
  border-radius: 6px;
}

.menu-btn:hover {
  background: var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(90deg, #f8fafc, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Search Input */
.search-box {
  position: relative;
  width: 240px;
}

.search-box input {
  width: 100%;
  padding: 8px 16px 8px 36px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
  width: 280px;
}

.search-box span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

/* Mode Switcher Toggle Button */
.mode-toggle-group {
  display: flex;
  background: var(--bg-primary);
  padding: 4px;
  border-radius: 24px;
  border: 1px solid var(--border-color);
}

.mode-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mode-btn.active {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

.print-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--accent-gold);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
}

.print-btn:hover {
  background: var(--accent-gold);
  color: #0f172a;
}

/* Main Layout */
.app-container {
  display: flex;
  margin-top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

/* Sidebar Navigation */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.sidebar-title {
  padding: 16px 20px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.nav-list {
  list-style: none;
  padding: 12px 8px;
}

.nav-item {
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.nav-link:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-link.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border-left: 4px solid var(--accent);
}

.chapter-num {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.nav-link.active .chapter-num {
  background: var(--accent);
  color: #0f172a;
}

/* Main Content Area */
.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 48px;
  background: var(--bg-primary);
  scroll-behavior: smooth;
}

.content-wrapper {
  max-width: 960px;
  margin: 0 auto;
  animation: fadeIn 0.4s ease-in-out;
}

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

/* Chapter Card Formatting */
.chapter-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
}

.chapter-badge {
  display: inline-block;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.chapter-title-main {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
}

.update-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 12px 18px;
  border-radius: 12px;
  margin-top: 16px;
  font-size: 14px;
}

/* Detailed vs Notes Content Blocks */
.view-mode-section {
  display: none;
}

.view-mode-section.active {
  display: block;
}

/* Content Styling */
.topic-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 28px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.topic-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topic-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 22px;
  background: var(--accent-gradient);
  border-radius: 2px;
}

p {
  margin-bottom: 16px;
  font-size: 16px;
  color: #e2e8f0;
}

.highlight-box {
  background: rgba(245, 158, 11, 0.1);
  border-left: 4px solid var(--accent-gold);
  padding: 16px 20px;
  border-radius: 8px;
  margin: 20px 0;
  font-size: 15px;
  color: #fef08a;
}

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

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.info-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.info-card h4 {
  font-size: 16px;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.info-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* Tables */
.data-table-wrapper {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 15px;
}

table.data-table th {
  background: var(--bg-card);
  color: var(--accent);
  padding: 14px 18px;
  font-weight: 700;
  border-bottom: 2px solid var(--border-color);
}

table.data-table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
  color: #cbd5e1;
}

table.data-table tr:last-child td {
  border-bottom: none;
}

table.data-table tr:hover td {
  background: rgba(56, 189, 248, 0.05);
}

/* Diagrams and Canvas Containers */
.diagram-box {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  margin: 28px 0;
  text-align: center;
  position: relative;
}

.diagram-caption {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 12px;
  font-style: italic;
}

/* Quick Notes Style (Bullet Point Mode) */
.notes-container .bullet-list {
  list-style-type: none;
  padding-left: 0;
}

.notes-container .bullet-item {
  position: relative;
  padding-left: 28px;
  margin-bottom: 14px;
  font-size: 16px;
  color: #e2e8f0;
}

.notes-container .bullet-item::before {
  content: '⚡';
  position: absolute;
  left: 0;
  top: 0;
  font-size: 14px;
}

.key-fact-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 8px;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .menu-btn {
    display: block;
  }
  .app-sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: 999;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-main {
    padding: 20px 16px;
  }
  .search-box {
    display: none;
  }
  .chapter-title-main {
    font-size: 24px;
  }
}

/* Print Styles */
@media print {
  .app-header, .app-sidebar, .menu-btn, .print-btn, .mode-toggle-group {
    display: none !important;
  }
  .app-container {
    margin-top: 0;
    height: auto;
  }
  .app-main {
    overflow: visible;
    padding: 0;
    background: #ffffff;
    color: #000000;
  }
  .topic-card {
    background: #ffffff;
    border: 1px solid #cccccc;
    color: #000000;
    box-shadow: none;
    page-break-inside: avoid;
  }
  p, .topic-title, .chapter-title-main {
    color: #000000 !important;
  }
}
