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

:root {
  --primary-color: #6366f1; /* Indigo 500 */
  --primary-hover: #4f46e5; /* Indigo 600 */
  --secondary-color: #10b981; /* Emerald 500 */
  
  /* Dark Mode Palette */
  --bg-color: #0f172a; /* Slate 900 */
  --surface-color: rgba(30, 41, 59, 0.7); /* Slate 800 with opacity for glassmorphism */
  --text-primary: #f8fafc; /* Slate 50 */
  --text-secondary: #94a3b8; /* Slate 400 */
  --border-color: rgba(255, 255, 255, 0.1);
  --danger-color: #ef4444; /* Red 500 */
  
  --sidebar-width: 260px;
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Glassmorphism Utilities */
.glass {
  background: var(--surface-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
}

/* Generic Buttons */
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-size: 0.95rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary-color), #059669);
  color: white;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

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

select.form-control {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 16px;
  cursor: pointer;
}

select.form-control option {
  background: #1e293b;
  color: #f8fafc;
}

.form-control.is-invalid {
  border-color: var(--danger-color);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Login/Auth Area */
.auth-wrapper {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top right, #1e1b4b, var(--bg-color));
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
  text-align: center;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-logo {
  width: 100%;
  max-width: 240px;
  height: auto;
  margin: 0 auto 1rem;
  display: block;
  object-fit: contain;
  /* Converts any colored logo to pure white for dark backgrounds */
  filter: brightness(0) invert(1) drop-shadow(0 2px 10px rgba(255, 255, 255, 0.2));
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
}

.auth-brand-icon {
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(34, 211, 238, 0.4));
}

.auth-brand-name {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: left;
  background: linear-gradient(135deg, #22d3ee, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.3px;
}

.auth-brand-name span {
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #67e8f9, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-header p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.85rem;
}

/* Dashboard Layout */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-right: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.sidebar-logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
  /* Converts any colored logo to pure white for dark sidebar */
  filter: brightness(0) invert(1) drop-shadow(0 1px 4px rgba(255, 255, 255, 0.15));
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-logo-main {
  font-size: 0.95rem;
  font-weight: 700;
  background: linear-gradient(135deg, #67e8f9, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.2px;
}

.sidebar-logo-sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(148, 163, 184, 0.7);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  transition: var(--transition);
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
}

.sidebar-menu li a.active {
  border-left: 3px solid var(--primary-color);
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2rem;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.topbar h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c084fc, #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Cards & Widgets */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-info h3 {
  font-size: 1.8rem;
  margin-bottom: 0.2rem;
}

.stat-info p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Data Tables */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

thead th {
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

tbody td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge-active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.badge-inactive {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* Animations */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .main-content {
    margin-left: 0;
  }
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--surface-color);
  backdrop-filter: blur(12px);
  border-left: 4px solid var(--secondary-color);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  color: white;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1), fadeOut 0.5s ease 3.5s forwards;
  min-width: 250px;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
