@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800;900&display=swap');

:root {
  /* Ultra Premium Palette (Dark Default) */
  --primary-color: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.5);
  --secondary-color: #f43f5e;
  --accent-color: #8b5cf6;
  
  --background-color: #0b0f1a;
  --surface-color: #121826;
  --surface-hover: #1c2436;
  
  --text-color: #f8fafc;
  --text-muted: #94a3b8;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --font-main: 'Inter', sans-serif;
  --font-heading: 'Outfit', sans-serif;
  
  --glass-bg: rgba(18, 24, 38, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-glow: rgba(99, 102, 241, 0.3);
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 30px 60px -12px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);
  
  --sidebar-width: 280px;
  --header-height: 80px;
  --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  
  /* Icon Toggles (Default Dark) */
  --icon-moon: block;
  --icon-sun: none;
}

[data-theme="light"] {
  --background-color: #f1f5f9;
  --surface-color: #ffffff;
  --surface-hover: #f8fafc;
  
  --text-color: #0f172a;
  --text-muted: #64748b;
  
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-border-glow: rgba(99, 102, 241, 0.15);
  
  --shadow-md: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 30px 60px -12px rgba(0, 0, 0, 0.1);
  
  /* Icon Toggles (Light) */
  --icon-moon: none;
  --icon-sun: block;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(244, 63, 94, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Base Elements */
a { text-decoration: none; color: inherit; transition: var(--transition); }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  color: white;
}

h1 { font-size: 4.5rem; line-height: 1.1; }
h2 { font-size: 3rem; line-height: 1.2; }
h3 { font-size: 2rem; }
h4 { font-size: 1.5rem; }

.gradient-text {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

/* Components */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 32px;
  border-radius: 16px;
  font-weight: 700;
  font-family: var(--font-heading);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-size: 0.95rem;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  color: white;
  box-shadow: 0 10px 25px -5px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 20px 40px -8px var(--primary-glow);
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  color: var(--text-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

/* Public Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  padding: 24px 0;
  transition: var(--transition);
}

.navbar.scrolled {
  padding: 16px 0;
  background: rgba(11, 15, 26, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 40px;
}

.nav-link {
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0.7;
}

.nav-link:hover {
  opacity: 1;
  color: var(--primary-color);
}

/* Mobile Menu Trigger */
.menu-toggle {
  display: none;
  font-size: 1.5rem;
  color: white;
  cursor: pointer;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.feature-card {
  padding: 40px;
  border-radius: 24px;
  text-align: center;
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-10px);
  border-color: var(--primary-color);
}

.feature-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  transition: var(--transition);
}

.feature-card:hover .feature-icon {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 10px 30px -5px var(--primary-glow);
}

/* Dashboard Architecture */
.dashboard-container {
  display: flex;
  min-height: 100vh;
  background: var(--background-color);
  position: relative;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface-color);
  border-right: 1px solid var(--glass-border);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
  transition: var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
}

.sidebar-brand span {
  background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  color: var(--text-muted);
  border-radius: 14px;
  margin-bottom: 8px;
  transition: var(--transition);
  gap: 14px;
  font-weight: 600;
  font-family: var(--font-heading);
  font-size: 0.95rem;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: white;
  transform: translateX(5px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  color: var(--primary-color);
  border: 1px solid rgba(99, 102, 241, 0.2);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.05);
}

.nav-item i { font-size: 1.3rem; }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 40px;
  transition: var(--transition);
  width: calc(100% - var(--sidebar-width));
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  gap: 32px;
}

.search-container {
  flex: 1;
  max-width: 480px;
}

.search-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  padding: 14px 20px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 16px;
  border-radius: 16px;
  transition: var(--transition);
  cursor: pointer;
}

.user-profile:hover { background: rgba(255, 255, 255, 0.03); }

/* Dashboard Widgets & Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.stat-card {
  padding: 32px;
  position: relative;
  overflow: hidden;
  border-radius: 20px;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 120px;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.03));
  border-radius: 0 0 0 100%;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 800;
  color: white;
  margin: 8px 0;
  line-height: 1.1;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.trend {
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
}

.trend.positive { color: var(--success); }
.trend.negative { color: var(--danger); }

/* Form Elements */
.form-group { margin-bottom: 24px; }
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-heading);
}

input, select, textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 14px 18px;
  border-radius: 14px;
  color: white;
  font-family: var(--font-main);
  transition: var(--transition);
  outline: none;
  font-size: 0.95rem;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* Animations */
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-up { opacity: 0; animation: slideInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--background-color); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
  border-radius: 10px;
}

/* Auth Pages */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--background-color);
  position: relative;
  overflow: hidden;
}

.auth-container::before {
  content: '';
  position: absolute;
  width: 1200px;
  height: 1200px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  opacity: 0.15;
  top: -400px;
  left: -400px;
  filter: blur(140px);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  padding: 56px;
  position: relative;
  z-index: 10;
}

.logo-box {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 32px auto;
  box-shadow: 0 10px 30px var(--primary-glow);
}

.btn-block { width: 100%; }

/* Mobile & Responsiveness */
@media (max-width: 1024px) {
  h1 { font-size: 3.5rem; }
  h2 { font-size: 2.5rem; }
  .sidebar { transform: translateX(-100%); width: 0; padding: 0; }
  .sidebar.active { transform: translateX(0); width: 280px; padding: 32px 24px; }
  .main-content { margin-left: 0; width: 100%; padding: 24px; }
  .menu-toggle { display: block; }
}

@media (max-width: 900px) {
  .features-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 80px;
    left: 20px;
    right: 20px;
    background: var(--surface-color);
    padding: 20px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--glass-border);
  }
  .hero { padding: 120px 0 80px 0; }
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .top-bar { flex-direction: column; gap: 20px; margin-bottom: 24px; }
  .search-container { max-width: 100%; width: 100%; order: 2; }
  .user-profile { justify-content: space-between; order: 1; }
  .auth-card { padding: 32px; width: 100%; }
  
  /* Mobile Carteirinha Adjustment */
  .card-preview { 
      transform: scale(0.85); 
      transform-origin: center top; 
      margin-bottom: -30px !important;
  }
}

@media print {
    body { background: white; color: black; }
    .sidebar, .top-bar, .no-print { display: none !important; }
    .main-content { margin: 0; padding: 0; width: 100%; }
    .card-preview { 
        break-inside: avoid; 
        box-shadow: none !important; 
        border: 1px solid #ccc !important;
        background: white !important;
        color: black !important;
    }
    /* Force background print */
    .card-preview .front { 
        background: #1e293b !important; 
        -webkit-print-color-adjust: exact; 
        print-color-adjust: exact; 
    }
    .card-preview .back { 
        background: #fff !important; 
        -webkit-print-color-adjust: exact; 
        print-color-adjust: exact; 
    }
}
