/* style.css - Premium CodInsta Nexus Admin UI */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-dark: #0f172a;
  --bg-panel: rgba(30, 41, 59, 0.7);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --purple: #8b5cf6;
  --green: #10b981;
  --red: #ef4444;
  --dark-accent: #1e293b;

  --sidebar-width: 280px;
  --radius-lg: 16px;
  --radius-md: 10px;
  
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background: var(--bg-dark);
  background-image: radial-gradient(circle at top right, rgba(59, 130, 246, 0.1), transparent 40%),
                    radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.1), transparent 40%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Typography Utilities */
.text-blue { color: var(--primary); }
.text-purple { color: var(--purple); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 2rem; }
.max-w-2xl { max-width: 800px; margin: 0 auto; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-glass);
  height: 100vh;
  position: fixed;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.brand {
  padding: 2rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-glow);
}

.brand h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand span {
  font-weight: 300;
  color: var(--text-muted);
}

.nav-menu {
  padding: 1rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  font-weight: 500;
  transition: var(--transition);
}

.nav-item i {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.nav-item:hover, .nav-item.active {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.15), transparent);
  border-left: 3px solid var(--primary);
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-profile img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border-glass);
}

.profile-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

.profile-info p {
  font-size: 0.75rem;
  color: var(--green);
}

.btn-logout {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background: var(--red);
  color: white;
}

/* ---------------- Main Content ---------------- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.top-header {
  height: 80px;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-search {
  display: flex;
  align-items: center;
  background: var(--dark-accent);
  border: 1px solid var(--border-glass);
  padding: 8px 16px;
  border-radius: 20px;
  width: 300px;
  transition: var(--transition);
}

.header-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.header-search i {
  color: var(--text-muted);
  margin-right: 10px;
}

.header-search input {
  background: transparent;
  border: none;
  color: white;
  outline: none;
  width: 100%;
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  gap: 15px;
}

.icon-btn {
  background: var(--dark-accent);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.icon-btn:hover {
  color: white;
  border-color: var(--text-muted);
}

.badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--red);
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.content-wrapper {
  padding: 2rem;
  flex: 1;
}

/* Tabs */
.tab-content {
  display: none;
  animation: fadeIn 0.4s ease-out;
}
.tab-content.active {
  display: block;
}

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

/* ---------------- Dashboard Overview ---------------- */
.welcome-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
}

.welcome-banner h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.welcome-banner p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.date-badge {
  background: var(--dark-accent);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.2);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.blue { background: rgba(59, 130, 246, 0.2); color: var(--primary); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.2); color: var(--purple); }
.stat-icon.green { background: rgba(16, 185, 129, 0.2); color: var(--green); }
.stat-icon.red { background: rgba(239, 68, 68, 0.2); color: var(--red); }

.stat-details p {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.stat-details h3 {
  font-size: 1.8rem;
  font-weight: 700;
}

/* ---------------- Panels & Tables ---------------- */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.table-container {
  overflow-x: auto;
}

.glass-table {
  width: 100%;
  border-collapse: collapse;
}

.glass-table th {
  text-align: left;
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-glass);
}

.glass-table td {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.95rem;
}

.glass-table tbody tr {
  transition: var(--transition);
}

.glass-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--dark-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--primary);
}

.user-details strong {
  display: block;
}
.user-details span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.role-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
}
.role-badge.admin {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

/* ---------------- Forms & Buttons ---------------- */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
  background: transparent;
  color: white;
  border: 1px solid var(--border-glass);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger-sm {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}

.btn-danger-sm:hover {
  background: var(--red);
  color: white;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
}
.btn-text:hover { text-decoration: underline; }

.modern-form .form-group {
  margin-bottom: 1.5rem;
}

.modern-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon i {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
}

.input-with-icon input, .input-with-icon select {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  padding: 12px 12px 12px 40px;
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  transition: var(--transition);
  outline: none;
}

.input-with-icon select {
  appearance: none;
}

.input-with-icon input:focus, .input-with-icon select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-row {
  display: flex;
  gap: 1.5rem;
}
.w-50 { width: 50%; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-glass);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding-top: 10px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 34px;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Toast Messages */
.message {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: var(--radius-md);
  color: white;
  font-weight: 500;
  box-shadow: var(--shadow-glow);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.message.success { background: var(--green); }
.message.error { background: var(--red); }
.message.info { background: var(--primary); }

/* Login Container overriding for the new style */
.login-container {
  max-width: 400px;
  width: 90%;
  margin: 10vh auto;
  padding: 2.5rem;
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.login-container h2 {
  font-size: 1.8rem;
  margin-bottom: 2rem;
  font-weight: 700;
}

.login-container input {
  width: 100%;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-glass);
  padding: 12px 16px;
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  margin-bottom: 1.2rem;
  outline: none;
  transition: var(--transition);
}

.login-container input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.login-container button {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.login-container button:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-glow);
}

/* ---------------- Responsive Dashboard Design ---------------- */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 70px;
  }

  .sidebar {
    width: var(--sidebar-width);
  }

  .brand h2,
  .brand span,
  .nav-item span,
  .profile-info,
  .sidebar-footer .admin-profile {
    display: none !important;
  }

  .brand {
    padding: 1.5rem 0.5rem;
    justify-content: center;
  }

  .nav-menu {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .nav-item {
    padding: 12px;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    margin-bottom: 0;
  }

  .nav-item i {
    font-size: 1.2rem;
    margin: 0;
  }

  .sidebar-footer {
    padding: 1rem 0.5rem;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    justify-content: center;
  }

  .admin-profile {
    justify-content: center;
  }

  .btn-logout {
    width: 38px;
    height: 38px;
  }

  .main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
  }

  .top-header {
    padding: 0 1rem;
    height: 70px;
  }

  .header-search {
    width: 160px;
    padding: 6px 12px;
  }

  .content-wrapper {
    padding: 1.25rem;
  }

  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 1.5rem;
  }

  .welcome-banner h1 {
    font-size: 1.5rem;
  }

  .welcome-banner p {
    font-size: 0.95rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .stat-card {
    padding: 1.2rem;
  }

  .glass-table th, .glass-table td {
    padding: 10px;
    font-size: 0.85rem;
  }
  
  .form-row {
    flex-direction: column;
    gap: 1rem;
  }
  
  .w-50 {
    width: 100%;
  }

  .max-w-2xl {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .top-header {
    justify-content: flex-end;
  }
  .header-search {
    display: none; /* Hide search bar on extra small screens */
  }
  .welcome-banner .date-badge {
    font-size: 0.8rem;
    padding: 6px 12px;
  }
}

