/* ==========================================================================
   EBIZNG Enterprise Design System — CSS3 Framework for cPanel / LAMP Host
   ========================================================================== */

:root {
  /* Core Color Palette */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.85);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  
  --crimson: #dc2626;
  --crimson-hover: #b91c1c;
  --crimson-light: #fee2e2;
  --crimson-glow: rgba(220, 38, 38, 0.15);
  
  --ink: #0b1120;
  --ink-surface: #0f172a;
  --ink-border: #1e293b;
  
  --accent-blue: #2563eb;
  --accent-purple: #9333ea;
  --accent-emerald: #059669;
  --accent-amber: #d97706;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-crimson: 0 10px 25px -5px rgba(220, 38, 38, 0.25);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --container-max: 1280px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --bg-primary: #0b1120;
  --bg-secondary: #0f172a;
  --bg-tertiary: #1e293b;
  --bg-card: #111827;
  --bg-card-hover: #1e293b;
  --bg-glass: rgba(15, 23, 42, 0.85);
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  
  --border-color: #1e293b;
  --border-light: #334155;
  
  --crimson-light: rgba(220, 38, 38, 0.15);
  --crimson-glow: rgba(220, 38, 38, 0.3);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

body {
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

h1 { font-size: clamp(2.25rem, 5vw, 3.75rem); }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.25rem; font-weight: 700; }
h5 { font-size: 1.1rem; }
h6 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; }

p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

p.lead {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.section {
  padding-top: 5rem;
  padding-bottom: 5rem;
  position: relative;
}

@media (min-width: 1024px) {
  .section {
    padding-top: 7rem;
    padding-bottom: 7rem;
  }
}

.section-bg-secondary {
  background-color: var(--bg-secondary);
}

.section-bg-dark {
  background-color: var(--ink);
  color: #ffffff;
}
.section-bg-dark p {
  color: #94a3b8;
}
.section-bg-dark h1, .section-bg-dark h2, .section-bg-dark h3 {
  color: #ffffff;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1024px) {
  .grid-cols-4, .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-cols-4, .grid-cols-3, .grid-cols-2 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-12 { gap: 3rem; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-crimson { color: var(--crimson); }
.text-white { color: #ffffff; }
.text-muted { color: var(--text-muted); }

/* Component: Header & Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-normal);
}

.top-bar {
  background: #0b1120;
  color: #94a3b8;
  font-size: 0.8rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.top-bar a {
  color: #e2e8f0;
}
.top-bar a:hover {
  color: var(--crimson);
}

.typewriter {
  display: inline-block;
  min-height: 1.2em;
  white-space: nowrap;
  overflow: hidden;
}
.typewriter::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  background: var(--crimson);
  vertical-align: -0.15em;
  animation: typewriter-blink 0.85s step-end infinite;
}
@keyframes typewriter-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
@media (max-width: 768px) {
  .typewriter {
    display: none;
  }
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.75rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo img {
  height: 68px;
  width: auto;
  object-fit: contain;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  list-style: none;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.5rem 0;
  position: relative;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
  color: var(--crimson);
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--crimson);
  border-radius: 2px;
}

/* Nav Dropdown */
.nav-dropdown {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 0.75rem;
  display: none;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 100;
}
.nav-dropdown:hover .dropdown-menu {
  display: flex;
}
.dropdown-item {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: background var(--transition-fast);
}
.dropdown-item:hover {
  background: var(--bg-secondary);
}
.dropdown-item strong {
  font-size: 0.9rem;
  color: var(--text-primary);
}
.dropdown-item span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.nav-actions .btn {
  white-space: nowrap;
}

/* Mobile Toggle */
.mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

@media (max-width: 1180px) {
  .nav-menu { display: none; }
  .mobile-toggle { display: block; }
  .nav-actions .btn-desktop { display: none; }
}

/* Mobile Drawer */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 85%;
  max-width: 380px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  z-index: 1000;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: var(--shadow-xl);
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}
.mobile-drawer.open {
  right: 0;
}
.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
}
.mobile-drawer-overlay.open {
  display: block;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.2;
}

.btn-primary {
  background: var(--crimson);
  color: #ffffff !important;
  box-shadow: var(--shadow-crimson);
}
.btn-primary:hover {
  background: var(--crimson-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary) !important;
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary) !important;
  border-color: var(--border-color);
}
.btn-outline:hover {
  background: var(--bg-secondary);
  border-color: var(--crimson);
  color: var(--crimson) !important;
}

/* Theme Toggle — sun/moon icon that rotates and crossfades based on the active theme */
.theme-toggle-btn {
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  overflow: hidden;
}
.theme-toggle-btn svg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.theme-toggle-btn .icon-sun {
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
  opacity: 1;
}
.theme-toggle-btn .icon-moon {
  transform: translate(-50%, -50%) rotate(90deg) scale(0.4);
  opacity: 0;
}
[data-theme="dark"] .theme-toggle-btn .icon-sun {
  transform: translate(-50%, -50%) rotate(-90deg) scale(0.4);
  opacity: 0;
}
[data-theme="dark"] .theme-toggle-btn .icon-moon {
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
  opacity: 1;
}

.btn-white {
  background: #ffffff;
  color: #0b1120 !important;
}
.btn-white:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}
.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge-crimson {
  background: var(--crimson-light);
  color: var(--crimson);
  border-color: rgba(220, 38, 38, 0.2);
}

.badge-blue {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.2);
}

.badge-emerald {
  background: rgba(5, 150, 105, 0.1);
  color: #059669;
  border-color: rgba(5, 150, 105, 0.2);
}

.badge-purple {
  background: rgba(147, 51, 234, 0.1);
  color: #9333ea;
  border-color: rgba(147, 51, 234, 0.2);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
}
.card:hover {
  border-color: rgba(220, 38, 38, 0.3);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.card-glow {
  position: relative;
  overflow: hidden;
}
.card-glow::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--crimson), #3b82f6, #9333ea);
}

/* Multitenant App Cards */
.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: all var(--transition-normal);
}
.app-card:hover {
  box-shadow: var(--shadow-xl);
  border-color: var(--crimson);
}
.app-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.app-card-logo-wrap {
  height: 64px;
  display: flex;
  align-items: center;
}
.app-card-logo-wrap img {
  max-height: 56px;
  width: auto;
  object-fit: contain;
}
/* SchoolPal's source logo has a flat off-white background baked into the file
   (not transparent) — wrap it in a white chip so it reads cleanly on dark cards
   instead of showing a mismatched box. */
.app-card-logo-wrap.has-opaque-logo img {
  background: #ffffff;
  border-radius: 8px;
  padding: 6px 10px;
}

.app-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}
.app-stat-item {
  text-align: center;
}
.app-stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}
.app-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.feature-list li::before {
  content: '✓';
  color: var(--crimson);
  font-weight: 800;
  display: inline-block;
}

/* Hero Section */
.hero-section {
  position: relative;
  padding-top: 6rem;
  padding-bottom: 6rem;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, var(--bg-secondary) 0%, var(--bg-primary) 70%);
}
.hero-glow-crimson {
  position: absolute;
  top: -10%;
  left: 20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(220, 38, 38, 0.12) 0%, rgba(220, 38, 38, 0) 70%);
  filter: blur(60px);
  pointer-events: none;
}
.hero-glow-blue {
  position: absolute;
  top: 10%;
  right: 15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0) 70%);
  filter: blur(60px);
  pointer-events: none;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-top: 4rem;
  padding: 2rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
}
@media (max-width: 768px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}
.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}
.form-control:focus {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px var(--crimson-glow);
}
textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

/* Interactive Tabs */
.tab-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.tab-btn {
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--text-primary);
}
.tab-btn.active {
  color: var(--crimson);
  border-bottom-color: var(--crimson);
}
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

/* Sliders */
.range-slider {
  width: 100%;
  accent-color: var(--crimson);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.toast {
  background: #0b1120;
  color: #ffffff;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  border-left: 4px solid var(--crimson);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Footer */
.site-footer {
  background: #0b1120;
  color: #94a3b8;
  padding-top: 5rem;
  padding-bottom: 2rem;
  border-top: 1px solid #1e293b;
  margin-top: auto;
}
.site-footer h5 {
  color: #ffffff;
  font-size: 1rem;
  margin-bottom: 1.25rem;
}
.site-footer a {
  color: #94a3b8;
}
.site-footer a:hover {
  color: #ffffff;
}
.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.9rem;
}
.footer-bottom {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}
@media (max-width: 768px) {
  .footer-bottom { flex-direction: column; gap: 1rem; text-align: center; }
}

/* Floating Back to top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-normal);
  z-index: 40;
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}
.back-to-top:hover {
  background: var(--crimson);
  color: #ffffff;
  border-color: var(--crimson);
}
