/* ============================================
   PCCKS e-Portfolio — Design System
   Modern, Premium UI with Thai Typography
   ============================================ */

/* ===== CSS Variables (Design Tokens) ===== */
:root {
  /* Primary Colors — Deep Indigo/Purple */
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-300: #a5b4fc;
  --primary-400: #818cf8;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --primary-800: #3730a3;
  --primary-900: #312e81;

  /* Accent Colors — Emerald */
  --accent-400: #34d399;
  --accent-500: #10b981;
  --accent-600: #059669;

  /* Warn/Error */
  --warn-400: #fbbf24;
  --warn-500: #f59e0b;
  --danger-400: #f87171;
  --danger-500: #ef4444;

  /* Neutral */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Background */
  --bg-primary: #f0f2f5;
  --bg-card: #ffffff;
  --bg-sidebar: #1e293b;
  --bg-glass: rgba(255, 255, 255, 0.8);

  /* Gamification Colors */
  --rank-bronze: #cd7f32;
  --rank-silver: #c0c0c0;
  --rank-gold: #ffd700;
  --rank-platinum: #e5e4e2;
  --rank-diamond: #b9f2ff;
  --rank-legend: linear-gradient(135deg, #f59e0b, #ef4444);

  /* Shadows - More Depth */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  --shadow-xl: 0 35px 60px -15px rgba(0, 0, 0, 0.1);
  --shadow-primary: 0 10px 30px -10px rgba(99, 102, 241, 0.4);

  /* Glassmorphism Styles */
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Transition */
  --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);

  /* Font */
  --font-sans: "Sarabun", "Noto Sans Thai", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px; /* Optimized base for Sarabun */
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--gray-800);
  line-height: 1.8; /* Increased for Sarabun readability */
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-700);
}

img {
  max-width: 100%;
  height: auto;
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 800; /* More authoritative for Sarabun */
  line-height: 1.4;
  color: var(--gray-900);
  font-family: var(--font-sans);
}

h1 {
  font-size: 2.2rem;
  letter-spacing: -0.5px;
}
h2 {
  font-size: 1.75rem;
}
h3 {
  font-size: 1.4rem;
}
h4 {
  font-size: 1.2rem;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-soft {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

@keyframes slideInRight {
  from { transform: translateX(-30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.animate-fade-in { animation: fadeIn 0.6s ease-out forwards; }
.animate-float { animation: float 4s ease-in-out infinite; }
.animate-pulse { animation: pulse-soft 2s infinite ease-in-out; }

/* ===== Glass Card ===== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
}

/* ===== Gamification Elements ===== */
.level-badge {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
    color: white;
    padding: 2px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.exp-bar-container {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 8px;
    position: relative;
}

.exp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-500), var(--primary-500));
    border-radius: var(--radius-full);
    transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rank-text {
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.7rem;
}
.rank-platinum { color: #8e8e8e; text-shadow: 0 0 10px rgba(229, 228, 226, 0.5); }
.rank-gold { color: #d4af37; text-shadow: 0 0 10px rgba(255, 215, 0, 0.4); }


/* ===== Layout ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--gray-900) 0%, var(--gray-800) 100%);
  color: white;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.sidebar-logo-text {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.3;
}

.sidebar-logo-text small {
  font-weight: 400;
  opacity: 0.6;
  font-size: 0.7rem;
  display: block;
}

/* Sidebar Navigation */
.sidebar-nav {
  padding: 16px 12px;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gray-400);
  padding: 0 12px;
  margin-bottom: 8px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--gray-300);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.nav-item-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger-500);
  color: white;
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

/* User Card in Sidebar */
.sidebar-user {
  padding: 16px 16px;
  margin: 0 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--primary-400);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--primary-300);
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
}

.top-bar {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-bar-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--gray-100);
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.1rem;
  position: relative;
}

.btn-icon:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.btn-icon .notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--danger-500);
  border: 2px solid white;
}

.page-content {
  padding: 32px;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 1rem;
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

/* ===== Stats Cards ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--stat-color, var(--primary-500));
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.stat-card-label {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 4px;
}

/* Stat Card color variants */
.stat-card.purple {
  --stat-color: var(--primary-500);
}
.stat-card.purple .stat-card-icon {
  background: var(--primary-50);
  color: var(--primary-600);
}

.stat-card.green {
  --stat-color: var(--accent-500);
}
.stat-card.green .stat-card-icon {
  background: #ecfdf5;
  color: var(--accent-600);
}

.stat-card.blue {
  --stat-color: #3b82f6;
}
.stat-card.blue .stat-card-icon {
  background: #eff6ff;
  color: #2563eb;
}

.stat-card.orange {
  --stat-color: #f59e0b;
}
.stat-card.orange .stat-card-icon {
  background: #fffbeb;
  color: #d97706;
}

.stat-card.red {
  --stat-color: var(--danger-500);
}
.stat-card.red .stat-card-icon {
  background: #fef2f2;
  color: var(--danger-500);
}

/* ===== Portfolio Grid ===== */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.portfolio-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  transition: var(--transition);
  position: relative;
}

.portfolio-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.portfolio-card-image {
  height: 180px;
  background: linear-gradient(135deg, var(--primary-100), var(--primary-50));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.portfolio-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portfolio-card-image .placeholder-icon {
  font-size: 3rem;
  color: var(--primary-300);
}

.portfolio-card-body {
  padding: 20px;
}

.portfolio-card-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--primary-50);
  color: var(--primary-700);
  margin-bottom: 10px;
}

.portfolio-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.portfolio-card-title a {
  color: var(--gray-900);
}

.portfolio-card-title a:hover {
  color: var(--primary-600);
}

.portfolio-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 12px;
}

.portfolio-card-featured {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(245, 158, 11, 0.9);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

/* Achievement Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-school {
  background: #dbeafe;
  color: #1d4ed8;
}
.badge-district {
  background: #e0e7ff;
  color: #4338ca;
}
.badge-province {
  background: #ede9fe;
  color: #6d28d9;
}
.badge-national {
  background: #fef3c7;
  color: #92400e;
}
.badge-intl {
  background: #d1fae5;
  color: #065f46;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
  color: white;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-400), var(--danger-500));
  color: white;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-200);
  color: var(--primary-600);
}

.btn-outline:hover {
  background: var(--primary-50);
  border-color: var(--primary-400);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 1rem;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger-500);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--gray-800);
  background: white;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.form-control::placeholder {
  color: var(--gray-400);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* File Upload */
.file-upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--gray-50);
}

.file-upload-area:hover {
  border-color: var(--primary-400);
  background: var(--primary-50);
}

.file-upload-area.dragover {
  border-color: var(--primary-500);
  background: var(--primary-100);
}

.file-upload-icon {
  font-size: 2.5rem;
  color: var(--gray-400);
  margin-bottom: 12px;
}

.file-upload-text {
  font-size: 0.9rem;
  color: var(--gray-500);
}

.file-upload-text strong {
  color: var(--primary-600);
}

/* ===== Alert Messages ===== */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* ===== Progress Bar ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary-500), var(--accent-500));
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Goals List ===== */
.goal-item {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  margin-bottom: 12px;
  transition: var(--transition);
}

.goal-item:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-sm);
}

.goal-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.goal-status {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
}

.goal-status.planning {
  background: #e0e7ff;
  color: #3730a3;
}
.goal-status.inprogress {
  background: #fef3c7;
  color: #92400e;
}
.goal-status.achieved {
  background: #d1fae5;
  color: #065f46;
}

/* ===== Gamification Badges ===== */
.badges-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.badge-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--gray-50), white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  transition: var(--transition);
}

.badge-item:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.badge-item-icon {
  font-size: 1.2rem;
}

/* ===== Grid & Flex Utils ===== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.gap-sm {
  gap: 8px;
}
.gap-md {
  gap: 16px;
}
.gap-lg {
  gap: 24px;
}
.mt-1 {
  margin-top: 8px;
}
.mt-2 {
  margin-top: 16px;
}
.mt-3 {
  margin-top: 24px;
}
.mb-1 {
  margin-bottom: 8px;
}
.mb-2 {
  margin-bottom: 16px;
}
.mb-3 {
  margin-bottom: 24px;
}
.text-center {
  text-align: center;
}
.text-sm {
  font-size: 0.85rem;
}
.text-muted {
  color: var(--gray-500);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  color: var(--gray-600);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--gray-400);
  margin-bottom: 20px;
}

/* ===== Auth Pages ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    #1e1b4b 0%,
    #312e81 30%,
    #3730a3 60%,
    #4338ca 100%
  );
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: "";
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.3), transparent);
  top: -200px;
  right: -200px;
  animation: float 8s ease-in-out infinite;
}

.auth-page::after {
  content: "";
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2), transparent);
  bottom: -150px;
  left: -100px;
  animation: float 6s ease-in-out infinite reverse;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-30px);
  }
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  padding: 48px 40px;
  position: relative;
  z-index: 10;
  animation: fadeUp 0.6s ease;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.auth-logo h1 {
  font-size: 1.4rem;
  color: var(--gray-900);
}

.auth-logo p {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ===== Mobile Responsive ===== */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-700);
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .page-content {
    padding: 16px;
  }

  .top-bar {
    padding: 0 16px;
  }

  .mobile-menu-btn {
    display: block;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .auth-card {
    margin: 16px;
    padding: 32px 24px;
  }

  .stat-card-value {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Sidebar Overlay (Mobile) ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

/* ===== Animations ===== */
.fade-in {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.slide-up {
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger animation for cards */
.portfolio-card:nth-child(1) {
  animation-delay: 0.05s;
}
.portfolio-card:nth-child(2) {
  animation-delay: 0.1s;
}
.portfolio-card:nth-child(3) {
  animation-delay: 0.15s;
}
.portfolio-card:nth-child(4) {
  animation-delay: 0.2s;
}
.portfolio-card:nth-child(5) {
  animation-delay: 0.25s;
}
.portfolio-card:nth-child(6) {
  animation-delay: 0.3s;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Sidebar Scrollbar */
.sidebar::-webkit-scrollbar-thumb {
  background: var(--gray-600);
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 32px;
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}

.pagination a {
  background: var(--bg-card);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

.pagination a:hover {
  background: var(--primary-50);
  border-color: var(--primary-200);
  color: var(--primary-600);
}

.pagination .active {
  background: var(--primary-600);
  color: white;
  border: none;
}

/* ===== Table ===== */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
}

td {
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
}

tr:hover td {
  background: var(--gray-50);
}

/* ===== Tags ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-600);
  margin: 2px;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* --- Sidebar Transitions & Mobile Mode --- */
@media (max-width: 992px) {
  .sidebar {
    transition: transform var(--transition);
  }
  .sidebar.hidden {
    transform: translateX(-100%);
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

/* --- Print Styles --- */
@media print {
  .sidebar, .top-bar, .btn, .card-footer, .form-group button, .alert, .stats-grid, script, .no-print {
    display: none !important;
  }
  
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    break-inside: avoid;
    margin-bottom: 25px !important;
    background: white !important;
    padding: 0 !important;
  }

  .card-body {
    padding: 20px !important;
  }

  body {
    background: white !important;
    color: black !important;
    font-size: 11pt !important;
  }

  h1, h2, h3 {
    color: black !important;
    page-break-after: avoid;
  }

  .portfolio-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
  }

  .portfolio-card {
    page-break-inside: avoid;
    border: 1px solid #eee !important;
  }

  .portfolio-card-image {
    display: block !important;
    height: 150px !important;
  }

  /* Force colors in print */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

