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

:root {
  /* Premium Light Theme Colors */
  --bg-primary: #f8fafc;       /* Light grayish blue background */
  --bg-secondary: #ffffff;     /* Pure white for panels/cards */
  --bg-tertiary: #f1f5f9;      /* Slightly darker for inputs/hover */
  
  --text-primary: #1e293b;     /* Dark slate for primary text */
  --text-secondary: #64748b;   /* Muted gray for secondary text */
  
  --accent-primary: #4f46e5;   /* Indigo for brand primary */
  --accent-secondary: #7c3aed; /* Violet for brand secondary */
  --accent-success: #059669;   /* Emerald */
  --accent-danger: #e11d48;    /* Rose */
  --accent-warning: #d97706;   /* Amber */
  
  --border-color: #e2e8f0;     /* Light gray borders */
  --glass-bg: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(255, 255, 255, 0.5);
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.025);
  --hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Base Layout Classes */
.app-container { display: flex; min-height: 100vh; position: relative; }

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: fixed;
  height: 100vh;
  z-index: 100;
  box-shadow: 2px 0 10px rgba(0,0,0,0.02);
}
.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}
.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white; /* Important for light mode */
  font-weight: 700;
  font-size: 18px;
}
.brand-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.nav-menu { padding: 20px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; overflow-y: auto;}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  color: var(--text-secondary); text-decoration: none; border-radius: var(--radius-md);
  transition: var(--transition); font-weight: 500; position: relative; overflow: hidden;
}
.nav-item::before {
  content: ''; position: absolute; left: 0; top: 0; height: 100%; width: 3px;
  background: linear-gradient(to bottom, var(--accent-primary), var(--accent-secondary));
  opacity: 0; transition: var(--transition); border-radius: 4px;
}
.nav-item:hover { color: var(--accent-primary); background-color: rgba(79, 70, 229, 0.05); }
.nav-item.active { color: var(--accent-primary); background-color: rgba(79, 70, 229, 0.08); font-weight: 600; }
.nav-item.active::before { opacity: 1; left: 4px; }

.nav-item svg { width: 20px; height: 20px; stroke-width: 2; transition: var(--transition); stroke: currentColor; fill: none; }
.nav-item.active svg { stroke: var(--accent-primary); }

/* Main Content */
.main-content { flex: 1; margin-left: 280px; min-height: 100vh; display: flex; flex-direction: column; transition: var(--transition); }

.topbar {
  height: 72px; padding: 0 32px;
  background-color: var(--glass-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.page-title { font-size: 20px; font-weight: 600; color: var(--text-primary); }

.topbar-actions { display: flex; align-items: center; gap: 20px; }
.branch-selector {
  background: var(--bg-tertiary); border: 1px solid var(--border-color); color: var(--text-primary);
  padding: 8px 32px 8px 16px; border-radius: var(--radius-sm); font-family: inherit; font-size: 14px;
  outline: none; cursor: pointer; transition: var(--transition); appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.branch-selector:focus { border-color: var(--accent-primary); background-color: #fff; box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1); }
.user-profile { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text-primary); font-weight: 500; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex; align-items: center; justify-content: center; font-weight: 600; color: white;
}

/* Mobile Toggle */
.mobile-toggle {
    display: none; background: transparent; border: none; cursor: pointer; margin-right: 16px; color: var(--text-primary);
}

/* Content */
.page-content { padding: 32px; flex: 1; }

/* Dashboard Cards */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; margin-bottom: 32px; }
.stat-card {
  background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 24px;
  position: relative; overflow: hidden; box-shadow: var(--card-shadow); transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--hover-shadow); border-color: rgba(79, 70, 229, 0.2); }
.stat-title {
  color: var(--text-secondary); font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between;
}
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.stat-icon svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; }
.stat-icon.indigo { color: var(--accent-primary); background: rgba(79, 70, 229, 0.1); }
.stat-icon.emerald { color: var(--accent-success); background: rgba(5, 150, 105, 0.1); }
.stat-icon.rose { color: var(--accent-danger); background: rgba(225, 29, 72, 0.1); }
.stat-icon.amber { color: var(--accent-warning); background: rgba(217, 119, 6, 0.1); }
.stat-value { font-size: 32px; font-weight: 700; margin-bottom: 8px; color: var(--text-primary); letter-spacing: -0.5px; }
.stat-trend { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; }
.stat-trend svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; }
.trend-up { color: var(--accent-success); background: rgba(5, 150, 105, 0.05); padding: 4px 8px; border-radius: 20px; display: inline-flex; }
.trend-down { color: var(--accent-danger); background: rgba(225, 29, 72, 0.05); padding: 4px 8px; border-radius: 20px; display: inline-flex; }

/* AI Insights Banner */
.ai-banner {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(124, 58, 237, 0.05));
  border: 1px solid rgba(79, 70, 229, 0.2); border-radius: var(--radius-lg);
  padding: 24px 32px; display: flex; align-items: flex-start; gap: 24px; margin-bottom: 32px;
  position: relative; overflow: hidden; box-shadow: var(--card-shadow);
}
.ai-icon-wrapper {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2); color: white;
}
.ai-icon-wrapper svg { width: 24px; height: 24px; stroke: #fff; }
.ai-content h3 { font-size: 18px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; color: var(--text-primary); }
.ai-badge {
  background: rgba(124, 58, 237, 0.1); color: var(--accent-secondary); font-size: 11px; padding: 3px 10px;
  border-radius: 20px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.ai-content p { color: var(--text-secondary); font-size: 14px; max-width: 800px; margin-bottom: 16px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm); font-family: var(--font-main);
  font-weight: 500; font-size: 14px; cursor: pointer; transition: var(--transition);
  border: none; outline: none; text-decoration: none;
}
.btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); color: white; box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35); }
.btn-outline { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border-color); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.btn-outline:hover { background: var(--bg-tertiary); border-color: #cbd5e1; }

/* Tables */
.glass-table-wrapper {
  background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--card-shadow);
  width: 100%; overflow-x: auto; /* mobile responsive */
}
.table-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.table-title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.table { width: 100%; border-collapse: collapse; text-align: left; background: var(--bg-secondary); min-width: 600px; }
.table th, .table td { padding: 16px 24px; border-bottom: 1px solid var(--border-color); }
.table th { color: var(--text-secondary); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; background-color: var(--bg-tertiary); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background-color: var(--bg-tertiary); }

/* Status */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.status.active { background: rgba(5, 150, 105, 0.1); color: var(--accent-success); border: 1px solid rgba(5, 150, 105, 0.2); }
.status.expired { background: rgba(225, 29, 72, 0.1); color: var(--accent-danger); border: 1px solid rgba(225, 29, 72, 0.2); }
.status.pending { background: rgba(217, 119, 6, 0.1); color: var(--accent-warning); border: 1px solid rgba(217, 119, 6, 0.2); }

/* Forms */
.search-box {
  display: flex; align-items: center; background: var(--bg-secondary);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  padding: 8px 16px; flex: 1; box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}
.search-box:focus-within { border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1); }
.search-box input { background: transparent; border: none; color: var(--text-primary); width: 100%; outline: none; font-family: inherit; margin-left: 10px; }
.search-box input::placeholder { color: var(--text-secondary); }
.search-box svg { width: 18px; height: 18px; stroke: var(--text-secondary); }
.form-group { margin-bottom: 20px; text-align: left; }
.form-label { display: block; margin-bottom: 8px; color: var(--text-primary); font-size: 14px; font-weight: 600; }
.form-control {
  width: 100%; padding: 10px 14px; background: var(--bg-secondary);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  color: var(--text-primary); font-family: inherit; transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1); }
.switch { display: inline-block; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background-color: var(--bg-tertiary); }
.login-box { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 48px 40px; width: 100%; max-width: 440px; box-shadow: var(--hover-shadow); text-align: center; }

/* Dashboard layout grid for memberships/billing */
.flex-layout { display: flex; gap: 24px; align-items: flex-start; }

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .flex-layout { flex-direction: column; }
  .flex-layout > div { width: 100%; flex: auto !important; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: 260px; z-index: 1000; }
  .sidebar.open { transform: translateX(0); }
  
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  
  .mobile-toggle { display: block; }
  .page-title { font-size: 16px; }
  .topbar { padding: 0 16px; height: 60px; }
  
  .dashboard-grid { grid-template-columns: 1fr; gap: 16px; }
  .ai-banner { padding: 16px; flex-direction: column; gap: 16px; }
  .ai-icon-wrapper { width: 40px; height: 40px; }
  .ai-icon-wrapper svg { width: 20px; height: 20px; }
  
  .branch-selector { width: 120px; /* Compress dropdown */ }
  .user-profile span { display: none; /* Hide name on mobile */ }
  
  .glass-table-wrapper { border-radius: var(--radius-md); }
  
  /* Sidebar Overlay (Backdrop for mobile) */
  .sidebar-overlay { 
      content: ''; display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; 
      background: rgba(0,0,0,0.5); z-index: 900; backdrop-filter: blur(2px);
  }
  .sidebar-overlay.active { display: block; }
}
