/* ═══════════════════════════════════════════════════════════════════
   Gyandeep Academy — Admin Stylesheet
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --navy:          #fffbeb;          /* Soft Cream page background */
  --navy-mid:      #0f172a;          /* Dark navy/slate sidebar */
  --navy-light:    #fde68a;          /* Light amber highlight */
  --indigo:        #0284c7;          /* Sky Blue */
  --indigo-mid:    #0369a1;
  --electric:      #0ea5e9;
  --electric-light:#0284c7;
  --violet:        #d946ef;
  --violet-light:  #f472b6;
  --white:         #ffffff;          /* White panel cards */
  --off-white:     #0f172a;          /* Dark text */
  --muted:         #475569;          /* Muted text */
  --accent-gold:   #f97316;          /* Playful Orange */
  --danger:        #ef4444;
  --success:       #22c55e;
  --font-main:     'Quicksand', system-ui, sans-serif;
  --font-alt:      'Fredoka', system-ui, sans-serif;
  --glass-bg:      rgba(255, 255, 255, 0.95);
  --glass-border:  rgba(2, 132, 199, 0.08);
  --sidebar-w:     260px;
  --sidebar-collapsed: 72px;
  --radius-sm:     12px;
  --radius-md:     20px;
  --t-mid:         300ms ease;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
body {
  font-family: var(--font-main);
  background: var(--navy);
  color: var(--off-white);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--indigo); text-decoration: none; }
a:hover { color: var(--indigo-mid); }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ── Admin Layout ─────────────────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  transition: grid-template-columns var(--t-mid);
}
.admin-layout.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed) 1fr;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */
.admin-sidebar {
  grid-row: 1 / -1;
  background: var(--navy-mid);
  border-right: 1px solid var(--glass-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow: hidden;
  transition: width var(--t-mid);
  width: var(--sidebar-w);
  z-index: 200;
}
.admin-layout.sidebar-collapsed .admin-sidebar { width: var(--sidebar-collapsed); }

.sidebar-logo {
  padding: 24px 20px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--glass-border);
  min-height: 70px;
  overflow: hidden; white-space: nowrap;
}
.sidebar-logo-icon { font-size: 1.6rem; flex-shrink: 0; }
.sidebar-logo-text {
  font-family: var(--font-alt); font-size: 1rem; font-weight: 700; color: var(--white);
  transition: opacity var(--t-mid), width var(--t-mid);
}
.admin-layout.sidebar-collapsed .sidebar-logo-text { opacity: 0; width: 0; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; font-size: 0.92rem;
  cursor: pointer; transition: background var(--t-mid), color var(--t-mid);
  white-space: nowrap; overflow: hidden;
  position: relative;
  text-decoration: none;
  margin-bottom: 2px;
}
.sidebar-nav-item:hover, .sidebar-nav-item.active {
  background: rgba(99,102,241,0.15);
  color: var(--electric-light);
}
.sidebar-nav-item.active { border-left: 3px solid var(--electric); padding-left: 9px; }
.sidebar-nav-icon { font-size: 1.1rem; flex-shrink: 0; }
.sidebar-nav-label { transition: opacity var(--t-mid); }
.admin-layout.sidebar-collapsed .sidebar-nav-label { opacity: 0; }

.sidebar-divider { height: 1px; background: var(--glass-border); margin: 10px 0; }

.sidebar-bottom { padding: 16px 12px; border-top: 1px solid var(--glass-border); }
.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--glass-bg); overflow: hidden; white-space: nowrap;
}
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo-mid), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 700; color: var(--white);
  flex-shrink: 0;
}
.sidebar-user-info { transition: opacity var(--t-mid); }
.admin-layout.sidebar-collapsed .sidebar-user-info { opacity: 0; }
.sidebar-username { font-weight: 600; color: var(--off-white); font-size: 0.88rem; }
.sidebar-role     { font-size: 0.75rem; color: var(--electric-light); }

/* ── Top Bar ──────────────────────────────────────────────────────── */
.admin-topbar {
  grid-column: 2;
  background: var(--navy-mid);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 32px;
  height: 70px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  color: var(--muted); width: 38px; height: 38px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-mid), color var(--t-mid);
}
.sidebar-toggle:hover { background: rgba(99,102,241,0.2); color: var(--electric-light); }
.page-breadcrumb { font-size: 0.9rem; color: var(--muted); }
.page-breadcrumb span { color: var(--electric-light); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-action-btn {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  color: var(--muted); padding: 8px 16px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem;
  display: flex; align-items: center; gap: 8px;
  transition: background var(--t-mid);
  text-decoration: none; font-family: var(--font-main);
}
.topbar-action-btn:hover { background: rgba(99,102,241,0.15); color: var(--electric-light); }
.logout-btn { color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.logout-btn:hover { background: rgba(239,68,68,0.15); color: #fca5a5; }

/* ── Main Content ─────────────────────────────────────────────────── */
.admin-main {
  grid-column: 2;
  padding: 32px;
  overflow-y: auto;
}

/* ── Dashboard Overview Cards ─────────────────────────────────────── */
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 20px; margin-bottom: 32px; }

.overview-card {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius-md); padding: 24px;
  position: relative; overflow: hidden;
  transition: transform var(--t-mid), border-color var(--t-mid);
}
.overview-card:hover { transform: translateY(-4px); border-color: var(--electric); }
.overview-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--electric), var(--violet));
}
.overview-card-icon {
  width: 52px; height: 52px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin-bottom: 16px;
}
.overview-card-num {
  font-family: var(--font-alt); font-size: 2.2rem; font-weight: 800;
  color: var(--off-white); line-height: 1;
}
.overview-card-label { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }
.overview-card-change { font-size: 0.78rem; margin-top: 8px; color: #16a34a; }

.icon-blue   { background: rgba(99,102,241,0.15); }
.icon-violet { background: rgba(139,92,246,0.15); }
.icon-teal   { background: rgba(6,182,212,0.15); }
.icon-gold   { background: rgba(245,158,11,0.15); }

/* ── Panels / Cards ───────────────────────────────────────────────── */
.admin-panel {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden; margin-bottom: 24px;
}
.admin-panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex; align-items: center; justify-content: space-between;
}
.admin-panel-title { font-weight: 700; color: var(--off-white); font-size: 1rem; display: flex; align-items: center; gap: 10px; }
.admin-panel-body  { padding: 24px; }

/* ── Tables ───────────────────────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 13px 16px; text-align: left; }
.admin-table th { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); border-bottom: 1px solid var(--glass-border); }
.admin-table td { font-size: 0.9rem; color: var(--off-white); border-bottom: 1px solid rgba(99,102,241,0.08); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(99,102,241,0.05); }
.admin-table .actions { display: flex; gap: 8px; }

/* ── Forms ────────────────────────────────────────────────────────── */
.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.88rem; font-weight: 600; color: var(--off-white); margin-bottom: 8px; }
.form-control {
  width: 100%; padding: 11px 16px;
  background: var(--white); border: 2px solid rgba(2, 132, 199, 0.15);
  border-radius: var(--radius-sm); color: var(--off-white);
  font-family: var(--font-main); font-size: 0.92rem;
  outline: none; transition: border-color var(--t-mid), box-shadow var(--t-mid);
}
.form-control:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12); }
.form-control::placeholder { color: var(--muted); }
textarea.form-control { resize: vertical; min-height: 160px; }
select.form-control option { background: var(--white); color: var(--off-white); }

/* File drop zone */
.upload-zone {
  border: 2px dashed rgba(2, 132, 199, 0.2);
  border-radius: var(--radius-md); padding: 48px 24px;
  text-align: center; cursor: pointer;
  transition: border-color var(--t-mid), background var(--t-mid);
  position: relative;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--indigo);
  background: rgba(2, 132, 199, 0.05);
}
.upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-icon { font-size: 3rem; margin-bottom: 12px; }
.upload-zone h4 { color: var(--off-white); font-weight: 600; margin-bottom: 6px; }
.upload-zone p  { color: var(--muted); font-size: 0.85rem; }

/* Preview zone */
.upload-preview {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(99,102,241,0.08); border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-sm); margin-top: 12px;
  display: none;
}
.upload-preview.show { display: flex; }
.preview-thumb { width: 60px; height: 60px; border-radius: 6px; object-fit: cover; }
.preview-name  { font-size: 0.88rem; color: var(--off-white); flex: 1; }
.preview-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; }

/* ── Image Thumbnail Grid ─────────────────────────────────────────── */
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 14px; }
.thumb-item {
  border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--glass-border);
  position: relative; group: true;
  transition: border-color var(--t-mid);
}
.thumb-item:hover { border-color: var(--electric); }
.thumb-item img { width: 100%; height: 110px; object-fit: cover; }
.thumb-overlay {
  position: absolute; inset: 0;
  background: rgba(13,13,43,0.85);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  opacity: 0; transition: opacity var(--t-mid);
}
.thumb-item:hover .thumb-overlay { opacity: 1; }
.thumb-name { padding: 8px; font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Doc List ─────────────────────────────────────────────────────── */
.doc-list-item {
  display: flex; align-items: center; gap: 16px;
  padding: 13px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border); margin-bottom: 8px;
  background: var(--glass-bg); transition: border-color var(--t-mid);
}
.doc-list-item:hover { border-color: var(--electric); }
.doc-icon { font-size: 1.4rem; flex-shrink: 0; }
.doc-details { flex: 1; }
.doc-file-name { font-weight: 500; color: var(--off-white); font-size: 0.92rem; }
.doc-file-meta { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.doc-actions   { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Gallery Manager (Sortable) ───────────────────────────────────── */
.gallery-manage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 16px; }
.gallery-manage-item {
  border-radius: var(--radius-sm); overflow: visible;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg); cursor: grab;
  transition: border-color var(--t-mid), box-shadow var(--t-mid);
}
.gallery-manage-item:active { cursor: grabbing; }
.gallery-manage-item.sortable-ghost { opacity: 0.4; }
.gallery-manage-item.sortable-chosen { box-shadow: 0 0 20px rgba(99,102,241,0.5); border-color: var(--electric); }
.gallery-manage-img { width: 100%; height: 120px; object-fit: cover; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.gallery-manage-footer {
  padding: 10px; display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--glass-border);
}
.gallery-manage-caption { font-size: 0.75rem; color: var(--muted); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Featured badge */
.featured-badge {
  display: inline-block; font-size: 0.65rem; padding: 2px 7px;
  background: rgba(245,158,11,0.2); color: #fcd34d; border-radius: 4px;
  font-weight: 700; text-transform: uppercase; margin-top: 4px;
}

/* ── News Editor ──────────────────────────────────────────────────── */
.news-editor-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.news-list-item {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border); margin-bottom: 10px;
  background: var(--glass-bg); transition: border-color var(--t-mid);
}
.news-list-item:hover { border-color: var(--electric); }
.news-thumb { width: 72px; height: 54px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: var(--navy-light); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.news-item-info { flex: 1; }
.news-item-title { font-weight: 600; color: var(--off-white); font-size: 0.95rem; margin-bottom: 4px; line-height: 1.3; }
.news-item-meta  { font-size: 0.78rem; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.news-item-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: 50px;
  font-family: var(--font-main); font-weight: 600; font-size: 0.88rem;
  cursor: pointer; border: none; transition: all var(--t-mid);
  text-decoration: none; white-space: nowrap; line-height: 1;
}
.btn-primary {
  background: linear-gradient(135deg, var(--electric), var(--violet));
  color: var(--white); box-shadow: 0 4px 15px rgba(99,102,241,0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(99,102,241,0.5); color: var(--white); }
.btn-outline { background: transparent; color: var(--off-white); border: 1px solid var(--glass-border); }
.btn-outline:hover { background: var(--glass-bg); border-color: var(--electric); color: var(--indigo); }
.btn-danger  { background: rgba(239,68,68,0.12); color: #b91c1c; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.22); color: #b91c1c; }
.btn-success { background: rgba(34,197,94,0.12); color: #15803d; border: 1px solid rgba(34,197,94,0.3); }
.btn-success:hover { background: rgba(34,197,94,0.22); color: #15803d; }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-xs { padding: 5px 10px; font-size: 0.75rem; border-radius: 6px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ── Alerts ───────────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 20px;
  display: flex; align-items: flex-start; gap: 10px; font-size: 0.9rem;
}
.alert-success { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #15803d; }
.alert-error   { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.3);  color: #b91c1c; }
.alert-info    { background: rgba(99,102,241,0.12); border: 1px solid rgba(99,102,241,0.3); color: var(--indigo-mid); }

/* ── Login Page ───────────────────────────────────────────────────── */
.admin-login-body {
  background: var(--navy);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  position: relative; overflow: hidden;
}
.admin-login-body::before {
  content: '';
  position: absolute;
  background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(99,102,241,0.15) 0%, transparent 70%);
  inset: 0; pointer-events: none;
}
.login-card {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg); padding: 48px 40px;
  width: 100%; max-width: 440px;
  backdrop-filter: blur(20px);
  position: relative; z-index: 1;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5);
}
.login-logo {
  text-align: center; margin-bottom: 32px;
}
.login-logo .logo-icon { font-size: 3rem; display: block; margin-bottom: 8px; }
.login-logo h1 { font-family: var(--font-alt); font-size: 1.4rem; font-weight: 700; color: var(--off-white); }
.login-logo p  { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

/* ── Responsive Admin ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }
  .admin-sidebar {
    position: fixed; left: 0; top: 0; height: 100%;
    transform: translateX(-100%); width: var(--sidebar-w);
    z-index: 300; transition: transform var(--t-mid);
  }
  .admin-sidebar.mobile-open { transform: translateX(0); }
  .admin-topbar { grid-column: 1; }
  .admin-main   { grid-column: 1; padding: 20px 16px; }
  .admin-form-grid { grid-template-columns: 1fr; }
  .news-editor-layout { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .overview-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
}
