/* Modern Theme System untuk CVR Portal */
:root {
  /* Light Theme Colors - Palet Adem di Mata */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #64748b;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0891b2;
  
  /* Surface Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  
  /* Text Colors */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  
  /* Border & Shadow */
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  /* Sidebar */
  --sidebar-bg: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  --sidebar-text: #dbeafe;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.1);
  --sidebar-active: rgba(255, 255, 255, 0.15);
  
  /* Form Elements */
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --input-focus: #3b82f6;
  --input-focus-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
  
  /* Radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
}

/* Dark Theme */
[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --secondary: #6b7280;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --surface: #1e293b;
  --surface-hover: #334155;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  
  --border: #334155;
  --border-light: #475569;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
  
  --sidebar-bg: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  --sidebar-text: #cbd5e1;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.1);
  --sidebar-active: rgba(255, 255, 255, 0.15);
  
  --input-bg: #334155;
  --input-border: #475569;
  --input-focus: #3b82f6;
  --input-focus-shadow: 0 0 0 3px rgb(59 130 246 / 0.2);
}

/* Global Styles */
* {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

body {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
}

/* Cards */
.card {
  background-color: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-sm) !important;
  color: var(--text-primary) !important;
}

.card-header {
  background-color: var(--bg-tertiary) !important;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  font-weight: 600;
}

.card:hover {
  box-shadow: var(--shadow-md) !important;
}

/* Buttons */
.btn {
  border-radius: var(--radius) !important;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  color: var(--text-inverse) !important;
}

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

.btn-outline-primary {
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}

.btn-outline-primary:hover {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  color: var(--text-inverse) !important;
}

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

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

.btn-warning {
  background-color: var(--warning) !important;
  border-color: var(--warning) !important;
}

/* Forms */
.form-control, .form-select {
  background-color: var(--input-bg) !important;
  border: 1px solid var(--input-border) !important;
  border-radius: var(--radius) !important;
  color: var(--text-primary) !important;
  transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
  background-color: var(--input-bg) !important;
  border-color: var(--input-focus) !important;
  box-shadow: var(--input-focus-shadow) !important;
  color: var(--text-primary) !important;
}

.form-control::placeholder {
  color: var(--text-muted) !important;
}

.form-label {
  color: var(--text-primary) !important;
  font-weight: 500;
}

/* Tables */
.table {
  color: var(--text-primary) !important;
}

.table-striped > tbody > tr:nth-of-type(odd) > td,
.table-striped > tbody > tr:nth-of-type(odd) > th {
  background-color: var(--bg-tertiary) !important;
}

.table-hover > tbody > tr:hover > td,
.table-hover > tbody > tr:hover > th {
  background-color: var(--surface-hover) !important;
}

.table th {
  border-color: var(--border) !important;
  color: var(--text-secondary) !important;
  font-weight: 600;
}

.table td {
  border-color: var(--border) !important;
}

/* Alerts */
.alert {
  border-radius: var(--radius-md) !important;
  border: none !important;
}

.alert-success {
  background-color: rgba(16, 185, 129, 0.1) !important;
  color: var(--success) !important;
}

.alert-danger {
  background-color: rgba(239, 68, 68, 0.1) !important;
  color: var(--danger) !important;
}

.alert-warning {
  background-color: rgba(245, 158, 11, 0.1) !important;
  color: var(--warning) !important;
}

.alert-info {
  background-color: rgba(6, 182, 212, 0.1) !important;
  color: var(--info) !important;
}

/* Navbar */
.navbar {
  background-color: var(--surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
}

.navbar-brand, .navbar-nav .nav-link {
  color: var(--text-primary) !important;
}

/* Sidebar Modern */
.sidebar {
  background: var(--sidebar-bg) !important;
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
}

.sidebar-nav a {
  color: var(--sidebar-text) !important;
  border-radius: var(--radius) !important;
  margin: 0.25rem 0.75rem;
  padding: 0.75rem 1rem !important;
  transition: all 0.2s ease;
}

.sidebar-nav a:hover {
  background-color: var(--sidebar-hover) !important;
  color: var(--sidebar-text-active) !important;
  transform: translateX(4px);
}

.sidebar-nav a.active {
  background-color: var(--sidebar-active) !important;
  color: var(--sidebar-text-active) !important;
  font-weight: 600;
}

/* Badges */
.badge {
  border-radius: var(--radius) !important;
  font-weight: 500;
}

.text-bg-light {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

.bg-success {
  background-color: var(--success) !important;
}

.bg-info {
  background-color: var(--info) !important;
}

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1060;
  width: 3rem;
  height: 3rem;
  border-radius: 50% !important;
  background-color: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-md) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg) !important;
}

.theme-toggle i {
  font-size: 1.25rem;
}

/* Login Page Specific */
.login-container {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background-color: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  overflow: hidden;
}

.login-logo h3 {
  background: var(--sidebar-bg);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* Responsive Improvements */
@media (max-width: 768px) {
  .theme-toggle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
  }
  
  .theme-toggle i {
    font-size: 1rem;
  }
  
  .card-body {
    padding: 1rem !important;
  }
  
  .btn {
    padding: 0.75rem 1rem !important;
    font-size: 0.9rem;
  }
  
  .table-responsive {
    font-size: 0.875rem;
  }
}

/* Focus States for Accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
  outline: 2px solid var(--input-focus);
  outline-offset: 2px;
}

/* Smooth Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card, .alert {
  animation: fadeIn 0.3s ease-out;
}

/* Text Colors */
.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }

/* Border Colors */
.border-primary { border-color: var(--primary) !important; }
.border-success { border-color: var(--success) !important; }
.border-danger { border-color: var(--danger) !important; }
.border-warning { border-color: var(--warning) !important; }
.border-info { border-color: var(--info) !important; }
