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

:root {
  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --primary: #0066CC;
  --primary-dark: #004C99;
  --primary-light: #4D94FF;
  --accent: #FF6B00;
  --accent-dark: #CC5500;
  --bg: #F5F7FA;
  --bg-elevated: #FFFFFF;
  --bg-subtle: #E8ECF1;
  --card-bg: #FFFFFF;
  --card-bg-hover: #FAFBFC;
  --surface: #FFFFFF;
  --text: #1A1D23;
  --text-secondary: #5A6475;
  --text-muted: #8B95A5;
  --text-inverse: #FFFFFF;
  --border: #D1D9E6;
  --border-subtle: #E8ECF1;
  --divider: #D1D9E6;
  --success: #00A854;
  --warning: #FF8800;
  --danger: #FF2D2D;
  --info: #0066CC;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
  --shadow-glow: 0 0 20px rgba(0,102,204,0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0A0E14;
  --bg-elevated: #11161D;
  --bg-subtle: #1A202C;
  --card-bg: #11161D;
  --card-bg-hover: #1A202C;
  --surface: #11161D;
  --text: #F5F7FA;
  --text-secondary: #A0AEC0;
  --text-muted: #6B7280;
  --text-inverse: #0A0E14;
  --border: #2D3748;
  --border-subtle: #1A202C;
  --divider: #2D3748;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(0,102,204,0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1,h2,h3,h4,h5,h6 { font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; color: var(--text); margin-bottom: 0.75rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; } h4 { font-size: 0.95rem; }
p { margin-bottom: 0.75rem; line-height: 1.6; color: var(--text-secondary); }

/* SIDEBAR */
.sidebar {
  position: fixed; top: 0; left: 0; width: 240px; height: 100vh;
  background: var(--bg-elevated); border-right: 1px solid var(--border);
  z-index: 100; display: flex; flex-direction: column; transition: var(--transition);
}
.sidebar-brand { padding: 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.6rem; }
.sidebar-brand h1 { font-size: 1rem; font-weight: 800; color: var(--primary); letter-spacing: -0.02em; text-transform: uppercase; margin: 0; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.75rem 0.5rem; }
.sidebar-nav ul { list-style: none; }
.sidebar-nav li { margin-bottom: 0.15rem; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm); color: var(--text-secondary); text-decoration: none;
  font-weight: 600; font-size: 0.85rem; transition: var(--transition);
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(0,102,204,0.25);
}
.sidebar-nav a .icon { font-size: 1rem; width: 1.3rem; text-align: center; }

/* MAIN */
.main-content { margin-left: 240px; min-height: 100vh; padding: 1.5rem; transition: var(--transition); max-width: calc(100vw - 240px); }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.page-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; margin: 0; }

/* CARDS */
.card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: var(--transition); overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-subtle);
  font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; justify-content: space-between; color: var(--text);
}
.card-body { padding: 1.25rem; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; display: flex; align-items: center; gap: 0.8rem;
  box-shadow: var(--shadow-sm); transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff;
  box-shadow: var(--shadow-glow); flex-shrink: 0;
}
.stat-icon.blue { background: linear-gradient(135deg, #0066CC, #004C99); }
.stat-icon.green { background: linear-gradient(135deg, #00A854, #008042); }
.stat-icon.amber { background: linear-gradient(135deg, #FF8800, #CC6A00); }
.stat-icon.purple { background: linear-gradient(135deg, #7C3AED, #5B21B6); }
.stat-info h3 { font-size: 1.4rem; font-weight: 800; color: var(--text); line-height: 1; margin: 0; }
.stat-info p { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin: 0.25rem 0 0 0; }

/* FEATURES */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.feature-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem;
  text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 0.6rem;
  transition: var(--transition); box-shadow: var(--shadow-sm);
}
.feature-card:hover { border-color: var(--primary); box-shadow: var(--shadow-glow); }
.feature-icon {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; box-shadow: var(--shadow-glow);
}
.feature-card h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.feature-card p { color: var(--text-muted); font-size: 0.85rem; line-height: 1.5; margin: 0; }

/* TABLES */
.data-table { overflow-x: auto; }
.data-table table { width: 100%; border-collapse: collapse; min-width: 550px; }
.data-table thead th {
  background: var(--bg-subtle); color: var(--text-secondary); font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border);
}
.data-table tbody td { padding: 0.875rem 1rem; border-bottom: 1px solid var(--border-subtle); font-size: 0.85rem; color: var(--text); font-weight: 500; }
.data-table tbody tr:hover td { background: var(--card-bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* BADGES */
.badge {
  display: inline-flex; align-items: center; padding: 0.25rem 0.6rem;
  border-radius: 9999px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-green { background: #00A85415; color: #00A854; border: 1px solid #00A85430; }
.badge-red { background: #FF2D2D15; color: #FF2D2D; border: 1px solid #FF2D2D30; }
.badge-amber { background: #FF880015; color: #FF8800; border: 1px solid #FF880030; }
.badge-blue { background: #0066CC15; color: #0066CC; border: 1px solid #0066CC30; }
.badge-purple { background: #7C3AED15; color: #7C3AED; border: 1px solid #7C3AED30; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.5rem 1rem; border-radius: var(--radius-sm); font-family: var(--font);
  font-size: 0.85rem; font-weight: 700; text-decoration: none; cursor: pointer; border: none;
  transition: var(--transition); letter-spacing: 0.01em; white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 2px 8px rgba(0,102,204,0.25); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,102,204,0.35); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text); border-color: var(--primary); }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }

/* FORMS */
.form-label { display: block; font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.04em; }
.form-input {
  width: 100%; padding: 0.7rem 0.85rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 0.85rem; font-weight: 500;
  transition: var(--transition); outline: none;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,102,204,0.1); }
.form-input::placeholder { color: var(--text-muted); font-weight: 400; }
select.form-input {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238B95A5' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.8rem center; padding-right: 2.2rem;
}
textarea.form-input { resize: vertical; min-height: 100px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.form-field.full { grid-column: 1 / -1; }

/* TOGGLE */
.theme-toggle {
  background: var(--bg-subtle); border: 1.5px solid var(--border); border-radius: 9999px;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.1rem; color: var(--text-secondary); transition: var(--transition);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* PUBLIC NAVBAR */
.public-navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(245,247,250,0.9); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border);
  padding: 0 1.5rem; height: 60px; display: flex; align-items: center; justify-content: space-between;
}
[data-theme="dark"] .public-navbar { background: rgba(10,14,20,0.9); }

/* AUTH */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--bg) 0%, var(--bg-subtle) 100%); padding: 1.5rem; }
.auth-card { width: 100%; max-width: 400px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-lg); }
.auth-card h1 { text-align: center; margin-bottom: 0.4rem; font-size: 1.35rem; }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1.5rem; }
.auth-input {
  width: 100%; padding: 0.7rem 0.85rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 0.85rem; margin-bottom: 0.85rem;
  transition: var(--transition); outline: none;
}
.auth-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,102,204,0.1); }
.auth-submit {
  width: 100%; padding: 0.7rem; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border: none; border-radius: var(--radius-sm); font-family: var(--font);
  font-weight: 700; font-size: 0.9rem; cursor: pointer; transition: var(--transition); margin-top: 0.4rem;
  box-shadow: 0 2px 8px rgba(0,102,204,0.25);
}
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,102,204,0.35); }

/* RESPONSIVE */
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 1rem; max-width: 100vw; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
  .card-header { flex-wrap: wrap; gap: 0.4rem; }
  .public-navbar { padding: 0 1rem; height: 56px; }
  .public-navbar a { font-size: 0.8rem; padding: 0.35rem 0.5rem; }
}

/* DESKTOP DASHBOARD FIX */
@media (min-width: 1024px) {
  .sidebar { display: block !important; width: 240px !important; }
  .main-content { margin-left: 240px !important; width: calc(100% - 240px) !important; max-width: calc(100vw - 240px) !important; padding: 1.5rem !important; }
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .features-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .admin-dashboard-tables, .client-dashboard-panels { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 1rem !important; align-items: start !important; margin-top: 1.5rem !important; }
  .admin-dashboard-tables .card, .client-dashboard-panels .card, .features-grid .card, .features-grid .feature-card, .stats-grid .stat-card { width: 100% !important; min-width: 0 !important; }
  .data-table { overflow-x: auto !important; }
  .data-table table { min-width: 500px !important; }
}
@media (min-width: 1280px) { .main-content { padding: 1.75rem 2rem !important; } }
@media (max-width: 1023px) { .dashboard-section-grid, .admin-dashboard-tables, .client-dashboard-panels, .features-grid, .stats-grid { grid-template-columns: 1fr !important; } }


/* ===== PUBLIC PAGES ===== */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
@media (max-width: 640px) {
  .page-container { padding: 0 1rem; }
}

.section {
  padding: 4rem 0;
}
@media (max-width: 640px) {
  .section { padding: 2.5rem 0; }
}

.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.section-label {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  background: var(--primary);
  color: #fff;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}
.section-header h2 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}
.section-header p {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  max-width: 1000px;
  margin: 0 auto;
}
.pricing-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  text-align: center;
  transition: var(--transition);
}
.pricing-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-4px);
}
.pricing-card.featured {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(0,102,204,0.03) 100%);
}
.pricing-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}
.pricing-card .price {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  margin: 1rem 0;
}
.pricing-card .price span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
}
.pricing-card ul {
  list-style: none;
  margin: 1.5rem 0;
  text-align: left;
}
.pricing-card ul li {
  padding: 0.5rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.pricing-card ul li::before {
  content: "✓";
  color: var(--primary);
  font-weight: 700;
  margin-right: 0.5rem;
}

.form-group { margin-bottom: 1rem; }
.btn-block { width: 100%; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.95rem; }
.mt-2 { margin-top: 0.5rem; }

/* Hero section */
.hero-section {
  padding: 5rem 0;
  text-align: center;
}
.hero-section h1 {
  font-size: 2.25rem;
  margin-bottom: 1rem;
}
.hero-section p {
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}
@media (max-width: 640px) {
  .hero-section h1 { font-size: 1.75rem; }
  .hero-section p { font-size: 1rem; }
}


/* ===== DASHBOARD CONTAINER FIX ===== */
.dashboard-content {
  max-width: 100%;
  overflow-x: hidden;
}
.admin-dashboard-tables,
.client-dashboard-panels {
  max-width: 100%;
  overflow-x: hidden;
}
@media (min-width: 1024px) {
  .admin-dashboard-tables,
  .client-dashboard-panels {
    gap: 1rem !important;
  }
}


/* ===== SERVICES PAGE TIGHTER GRID ===== */
.features-grid.tight-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 0.875rem !important;
}
@media (min-width: 1024px) {
  .features-grid.tight-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}
