@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-color: #05070a;
  --panel-bg: rgba(10, 14, 23, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(139, 92, 246, 0.2);
  
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #4b5563;
  
  --primary: #8b5cf6;
  --primary-hover: #a78bfa;
  --primary-glow: rgba(139, 92, 246, 0.4);
  
  --accent: #3b82f6;
  --success: #10b981;
  --error: #ef4444;
  
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --header-height: 70px;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at top right, rgba(139, 92, 246, 0.06) 0%, transparent 40%),
    radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Glassmorphic Cards */
.glass-card {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  padding: 24px;
  transition: border-color 0.2s ease;
}
.glass-card:hover {
  border-color: var(--border-glow);
}

/* Auth Portal Overlay */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, #0d0f1a 0%, #030407 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 40px;
  text-align: center;
  border-radius: 16px;
}

.auth-logo {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 24px;
}

.auth-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 30px;
}

/* Google Login Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
}

.btn-google {
  background: #ffffff;
  color: #1f2937;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-google:hover {
  background: #f3f4f6;
  transform: translateY(-1px);
}
.btn-google img {
  width: 18px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 12px var(--primary-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
  padding: 6px 12px;
  font-size: 0.8rem;
}
.btn-danger:hover {
  background: var(--error);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover {
  background: #059669;
}

/* Application Navbar */
.navbar {
  height: var(--header-height);
  padding: 0 40px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 14, 23, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--primary-glow);
  color: var(--primary-hover);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--primary);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-email {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Tab Navigation Controls */
.dashboard-container {
  max-width: 1300px;
  width: 100%;
  margin: 40px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.tabs-bar {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 2px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 24px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--primary-hover);
  border-bottom-color: var(--primary);
}

/* Tab Pages Wrapper */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* Page Section Headers */
.section-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* Grid & Table structures */
.whitelist-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
}

@media (max-width: 900px) {
  .whitelist-grid {
    grid-template-columns: 1fr;
  }
}

.data-table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

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

.data-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
  font-weight: 600;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  vertical-align: middle;
}

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

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.01);
  color: var(--text-primary);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.06);
}

textarea.form-input {
  resize: vertical;
  min-height: 120px;
  font-family: monospace;
  font-size: 0.85rem;
}

/* Whitelist Cycle Editor drawer */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  margin-right: 4px;
  margin-bottom: 4px;
}

.badge-primary {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
  color: var(--primary-hover);
}

/* Visual Syllabus Editor Styles */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

@media (max-width: 1000px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
}

.visual-builder-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 700px;
  overflow-y: auto;
  padding-right: 10px;
}

.editor-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.builder-cycle {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  padding: 16px;
  margin-bottom: 12px;
}

.builder-chapter {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.01);
  padding: 14px;
  margin-top: 10px;
  margin-left: 10px;
}

.builder-lesson {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  margin-left: 20px;
  align-items: center;
}

.builder-lesson input {
  font-size: 0.8rem;
  padding: 8px 12px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-icon-danger:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* Whitelisting permissions helper UI */
.cycle-checklist-wrapper {
  margin-top: 15px;
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
}

.cycle-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.cycle-check-item:last-child {
  border-bottom: none;
}

.cycle-check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Spinner */
.spinner-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Fix white-on-white text in select option dropdowns */
select option {
  background-color: #0c0f16 !important;
  color: #f3f4f6 !important;
}

/* Premium Custom Dropdown styling */
.custom-dropdown {
  position: relative;
  width: 100%;
  user-select: none;
}

.dropdown-trigger {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.dropdown-trigger:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(139, 92, 246, 0.3);
}

.custom-dropdown.open .dropdown-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.dropdown-arrow {
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.custom-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
  color: var(--primary-hover);
}

.dropdown-options {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  background: rgba(13, 17, 28, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 500;
  max-height: 250px;
  overflow-y: auto;
}

.custom-dropdown.open .dropdown-options {
  display: block;
  animation: dropdownSlide 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownSlide {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-option {
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropdown-option:hover {
  background: var(--primary-glow);
  color: #fff;
}

.dropdown-option.selected {
  background: var(--primary);
  color: #fff;
}

/* Mobile Responsive Tweak Rules for Admin Portal */
@media (max-width: 700px) {
  .navbar {
    padding: 12px 16px;
    flex-direction: column;
    height: auto;
    gap: 12px;
    align-items: flex-start;
  }
  
  .navbar-user {
    width: 100%;
    justify-content: space-between;
  }
  
  .dashboard-container {
    margin: 20px auto;
    padding: 0 12px;
    gap: 20px;
  }
  
  .tabs-bar {
    flex-direction: column;
    border-bottom: none;
    gap: 4px;
  }
  
  .tab-btn {
    width: 100%;
    text-align: left;
    border-bottom: none;
    border-left: 3px solid transparent;
    padding: 10px 14px;
    font-size: 0.95rem;
    border-radius: 6px;
  }
  
  .tab-btn.active {
    border-left-color: var(--primary);
    background: rgba(139, 92, 246, 0.06);
  }
  
  .glass-card {
    padding: 16px;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  /* Course visual builder */
  .editor-layout {
    gap: 20px;
  }
  
  .builder-lesson {
    flex-direction: column;
    align-items: flex-start;
    margin-left: 10px;
    gap: 6px;
    border-bottom: 1px dashed rgba(255,255,255,0.04);
    padding-bottom: 12px;
  }
  
  .builder-lesson div {
    width: 100%;
  }
  
  .builder-lesson .delete-lesson-btn {
    align-self: flex-end;
  }
}

/* Abstract Background Blobs */
.bg-blob {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.07;
  z-index: -10;
  pointer-events: none;
  animation: floatBlob 25s infinite alternate ease-in-out;
}
.blob-1 {
  background: var(--primary);
  top: -10%;
  left: -15%;
}
.blob-2 {
  background: #3b82f6;
  bottom: -15%;
  right: -15%;
  animation-delay: -8s;
}
@keyframes floatBlob {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 90px) scale(1.15); }
  100% { transform: translate(-40px, -60px) scale(0.9); }
}

/* Premium Button Overrides */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #6d28d9 100%) !important;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
  transition: all 0.25s ease !important;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #7c3aed 100%) !important;
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.45) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  transition: all 0.25s ease !important;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.04) !important;
}

/* High-Tech Grid Background Pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 50px 50px;
  background-position: center center;
  z-index: -9;
  pointer-events: none;
}
