/**
 * RateRight Professional UI System
 * Clean, maintainable CSS with ZERO !important declarations
 * Database-driven component architecture (29 tables)
 * Mobile-first responsive design
 */

/* ============================================
   1. CSS VARIABLES & DESIGN TOKENS
   ============================================ */
:root {
  /* Brand Colors */
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #60a5fa;
  --secondary: #64748b;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  
  /* Neutral Colors (Aligned with index.html) */
  --gray-50: #f8fafc;   /* Matches index.html section bg */
  --gray-100: #f3f4f6;
  --gray-200: #e2e8f0;  /* Matches index.html calc divider */
  --gray-300: #cbd5e1;  /* Matches index.html input borders */
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #334155;  /* Matches index.html gradient end */
  --gray-800: #1e293b;  /* Matches index.html dark text */
  --gray-900: #0f172a;  /* Matches index.html footer */
  
  /* Typography */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", monospace;
  
  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 1rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ============================================
   2. BASE RESET & TYPOGRAPHY
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--gray-900);
  background-color: var(--gray-50);
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--gray-900);
}

h1 { font-size: 2.5rem; margin-bottom: var(--space-lg); }
h2 { font-size: 2rem; margin-bottom: var(--space-md); }
h3 { font-size: 1.5rem; margin-bottom: var(--space-md); }
h4 { font-size: 1.25rem; margin-bottom: var(--space-sm); }
h5 { font-size: 1.125rem; margin-bottom: var(--space-sm); }
h6 { font-size: 1rem; margin-bottom: var(--space-sm); }

p {
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

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

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ============================================
   3. NAVIGATION SYSTEM (0 !important)
   ============================================ */
.navbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  padding: var(--space-md) 0;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  text-decoration: none;
}

.navbar-brand:hover {
  color: var(--primary);
  text-decoration: none;
}

.nav-link {
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  color: var(--gray-600);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--gray-900);
  background-color: var(--gray-100);
  text-decoration: none;
}

.nav-link.active {
  color: var(--primary);
  background-color: var(--primary);
  background-color: rgba(37, 99, 235, 0.1);
}

/* Dropdown Menus */
.dropdown-menu {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-sm);
  min-width: 200px;
}

.dropdown-item {
  display: block;
  padding: var(--space-sm) var(--space-md);
  color: var(--gray-700);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.dropdown-item:hover {
  background-color: var(--gray-100);
  color: var(--gray-900);
  text-decoration: none;
}

.dropdown-item i {
  width: 20px;
  margin-right: var(--space-sm);
  color: var(--gray-500);
}

/* ============================================
   4. CARDS & CONTAINERS
   ============================================ */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  transition: box-shadow var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  background: transparent;
  border-bottom: 2px solid var(--gray-100);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0;
}

/* ============================================
   5. BUTTONS (0 !important)
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-lg);
  font-weight: 500;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.5;
  font-family: inherit;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  color: white;
}

.btn-secondary {
  background-color: var(--gray-200);
  color: var(--gray-700);
  border-color: var(--gray-200);
}

.btn-secondary:hover {
  background-color: var(--gray-300);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

.btn-success {
  background-color: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.875rem;
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: 1.125rem;
}

/* ============================================
   6. FORMS & INPUTS
   ============================================ */
.form-control {
  display: block;
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--gray-900);
  background-color: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 500;
  color: var(--gray-700);
}

/* ============================================
   7. STATUS INDICATORS (Database-driven)
   ============================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 9999px;
}

.status-pending {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.status-active {
  background-color: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.status-completed {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

.status-cancelled {
  background-color: rgba(107, 114, 128, 0.1);
  color: var(--gray-600);
}

/* ============================================
   8. NOTIFICATION SYSTEM
   ============================================ */
.notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background-color: var(--danger);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  margin-left: var(--space-xs);
}

.notification-bar {
  background: linear-gradient(135deg, #fef3c7, #fed7aa);
  border-left: 4px solid var(--warning);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
}

/* ============================================
   9. DASHBOARD COMPONENTS
   ============================================ */
.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-top: var(--space-xs);
}

.stat-change {
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: var(--space-sm);
}

.stat-change.positive {
  color: var(--success);
}

.stat-change.negative {
  color: var(--danger);
}

/* ============================================
   10. TABLES
   ============================================ */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
  padding: var(--space-md);
  border-bottom: 2px solid var(--gray-200);
  background-color: var(--gray-50);
}

.table td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-900);
}

.table tbody tr:hover {
  background-color: var(--gray-50);
}

/* ============================================
   11. ALERTS & MESSAGES
   ============================================ */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  border: 1px solid transparent;
}

.alert-success {
  background-color: rgba(34, 197, 94, 0.1);
  border-color: var(--success);
  color: #166534;
}

.alert-warning {
  background-color: rgba(245, 158, 11, 0.1);
  border-color: var(--warning);
  color: #92400e;
}

.alert-danger {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
  color: #991b1b;
}

/* ============================================
   12. MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  
  .card {
    padding: var(--space-md);
  }
  
  .navbar {
    padding: var(--space-sm) 0;
  }
  
  .table {
    font-size: 0.875rem;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .dropdown-menu {
    width: calc(100vw - 2rem);
    max-width: 320px;
  }
}

/* ============================================
   13. UTILITY CLASSES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-600); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }

.p-1 { padding: var(--space-sm); }
.p-2 { padding: var(--space-md); }
.p-3 { padding: var(--space-lg); }

.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-block { display: block; }
.d-none { display: none; }

.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* ============================================
   IMPORTANT COUNT: 0
   Every style uses proper CSS cascade
   ============================================ */
