/* ==============================================================================
   ALI KHAN PORTFOLIO — ADMIN PANEL STYLESHEET (GLOSSY EDITION)
   Professional • Clean Dashboard • Glassmorphic • Responsive • Zero Frameworks
   ============================================================================== */

:root {
  --admin-bg: #060913;
  --admin-sidebar-bg: rgba(12, 18, 34, 0.88);
  --admin-card-bg: rgba(16, 24, 43, 0.65);
  --admin-card-hover: rgba(24, 35, 62, 0.85);
  --admin-border: rgba(255, 255, 255, 0.08);
  --admin-border-light: rgba(255, 255, 255, 0.14);

  --admin-text: #f9fafb;
  --admin-text-muted: #9ca3af;
  --admin-text-subtle: #6b7280;

  --admin-primary: #6366f1;
  --admin-primary-hover: #4f46e5;
  --admin-accent: #34d399;
  --admin-warning: #fbbf24;
  --admin-danger: #f87171;

  --sidebar-width: 250px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

[data-theme="light"] {
  --admin-bg: #f8fafd;
  --admin-sidebar-bg: rgba(255, 255, 255, 0.88);
  --admin-card-bg: rgba(255, 255, 255, 0.75);
  --admin-card-hover: rgba(255, 255, 255, 0.95);
  --admin-border: rgba(226, 232, 240, 0.85);
  --admin-border-light: rgba(203, 213, 225, 0.9);

  --admin-text: #0f172a;
  --admin-text-muted: #475569;
  --admin-text-subtle: #64748b;

  --admin-primary: #4f46e5;
  --admin-primary-hover: #4338ca;
}

/* -------------------------------------------------------------
   GLOBAL ADMIN LAYOUT
   ------------------------------------------------------------- */
body.admin-body {
  background-color: var(--admin-bg);
  color: var(--admin-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  display: flex;
  min-height: 100vh;
  position: relative;
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0);
  background-size: 28px 28px;
}

.structured-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(8px);
  overflow: auto;
}

.structured-editor-form {
  width: min(780px, 100%);
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--admin-card-bg);
  color: var(--admin-text);
  border: 1px solid var(--admin-border-light);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.structured-editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.35rem 1rem;
  border-bottom: 1px solid var(--admin-border);
}

.structured-editor-kicker {
  color: var(--admin-accent);
  font: 700 0.68rem/1 var(--font-mono, monospace);
  letter-spacing: 0.12em;
}

.structured-editor-form h2 {
  color: var(--admin-text);
  font-size: 1.15rem;
  margin: 0.45rem 0 0.25rem;
}

.structured-editor-header p {
  color: var(--admin-text-muted);
  font-size: 0.8rem;
  margin: 0;
}

.structured-editor-close {
  width: 2rem;
  height: 2rem;
  padding: 0 !important;
  border-radius: 50% !important;
  font-size: 1.35rem;
  line-height: 1;
}

.structured-editor-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding: 1.2rem 1.35rem;
  overflow: auto;
}

.structured-editor-field {
  display: grid;
  gap: 0.4rem;
}

.structured-editor-field:has(textarea) {
  grid-column: 1 / -1;
}

.structured-editor-form label {
  color: var(--admin-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.structured-editor-form input:not([type="checkbox"]),
.structured-editor-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--admin-border-light);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  background: var(--admin-bg);
  color: var(--admin-text);
  font: inherit;
}

.structured-editor-form input:focus,
.structured-editor-form textarea:focus {
  outline: 2px solid var(--admin-primary);
  outline-offset: 1px;
}

.structured-editor-check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.4rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
}

.structured-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
  padding: 0.9rem 1.35rem;
  border-top: 1px solid var(--admin-border);
  background: var(--admin-card-bg);
}

.structured-editor-form button {
  border: 1px solid var(--admin-border-light);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  background: var(--admin-card-bg);
  color: var(--admin-text);
  cursor: pointer;
}

.structured-editor-form button[type="submit"] {
  background: var(--admin-primary);
  border-color: var(--admin-primary);
  color: #fff;
}

@media (max-width: 640px) {
  .structured-editor-overlay {
    align-items: flex-start;
    padding: 0.55rem;
  }

  .structured-editor-form {
    max-height: 94vh;
    border-radius: 10px;
  }

  .structured-editor-fields {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .structured-editor-field:has(textarea) {
    grid-column: auto;
  }

  .structured-editor-header,
  .structured-editor-actions {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

[data-theme="light"] body.admin-body {
  background-image: radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 0);
}

/* -------------------------------------------------------------
   AUTH OVERLAY SCREEN (LOGIN)
   ------------------------------------------------------------- */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(6, 9, 19, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  background: var(--admin-card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--admin-border-light);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  padding: 2.75rem 2.25rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--admin-primary), #38bdf8);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--admin-text);
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 0.885rem;
  color: var(--admin-text-muted);
}

.auth-notice {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.75rem;
  font-size: 0.815rem;
  color: #c7d2fe;
  line-height: 1.5;
}

[data-theme="light"] .auth-notice {
  color: #4338ca;
}

/* -------------------------------------------------------------
   SIDEBAR (FROSTED GLASS)
   ------------------------------------------------------------- */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--admin-sidebar-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-brand {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--admin-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  list-style: none;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  color: var(--admin-text-muted);
  font-size: 0.885rem;
  font-weight: 500;
  text-align: left;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  transition: all 0.18s ease;
}

.sidebar-btn:hover {
  background: var(--admin-card-hover);
  color: var(--admin-text);
}

.sidebar-btn.active {
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.35);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .sidebar-btn.active {
  color: #4f46e5;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--admin-border);
  font-size: 0.8rem;
  color: var(--admin-text-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* -------------------------------------------------------------
   MAIN CONTENT AREA
   ------------------------------------------------------------- */
.admin-main {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  height: 4.25rem;
  background: var(--admin-sidebar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--admin-text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.admin-content {
  padding: 2.25rem 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* -------------------------------------------------------------
   DASHBOARD OVERVIEW METRICS
   ------------------------------------------------------------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.35rem;
  margin-bottom: 2.25rem;
}

.metric-card {
  background: var(--admin-card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 1.65rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  border-color: var(--admin-border-light);
}

.metric-label {
  font-size: 0.8rem;
  font-family: ui-monospace, monospace;
  text-transform: uppercase;
  color: var(--admin-text-subtle);
  margin-bottom: 0.45rem;
  letter-spacing: 0.04em;
}

.metric-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--admin-text);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.775rem;
  font-family: ui-monospace, monospace;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-weight: 600;
  backdrop-filter: blur(6px);
}

.status-online {
  background: rgba(52, 211, 153, 0.14);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.status-demo {
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.35);
}

/* -------------------------------------------------------------
   PANEL SECTIONS & FORMS (GLOSSY)
   ------------------------------------------------------------- */
.panel-tab {
  display: none;
}

.panel-tab.active {
  display: block;
}

.panel-card {
  background: var(--admin-card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  padding: 2.25rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.panel-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.15) 0%, transparent 80%);
  pointer-events: none;
}

.panel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.35rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--admin-border);
}

.panel-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--admin-text);
  letter-spacing: -0.01em;
}

.panel-subtitle {
  font-size: 0.885rem;
  color: var(--admin-text-muted);
  margin-top: 0.3rem;
}

/* Form Controls */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.35rem;
  margin-bottom: 1.35rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.35rem;
}

.form-label {
  font-size: 0.865rem;
  font-weight: 600;
  color: var(--admin-text);
}

.form-help {
  font-size: 0.785rem;
  color: var(--admin-text-subtle);
}

.form-input, .form-textarea, .form-select {
  padding: 0.72rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  color: var(--admin-text);
  font-size: 0.915rem;
  transition: all 0.2s ease;
}

[data-theme="light"] .form-input, [data-theme="light"] .form-textarea, [data-theme="light"] .form-select {
  background: rgba(255, 255, 255, 0.85);
}

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

.form-textarea {
  resize: vertical;
  min-height: 110px;
}

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  position: relative;
  width: 46px;
  height: 25px;
  background: var(--admin-border);
  border-radius: 9999px;
  transition: background-color 0.2s;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

input[type="checkbox"]:checked + .toggle-switch {
  background: var(--admin-primary);
}

input[type="checkbox"]:checked + .toggle-switch::after {
  transform: translateX(21px);
}

/* -------------------------------------------------------------
   DATA TABLES & LISTS
   ------------------------------------------------------------- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.895rem;
}

.admin-table th {
  text-align: left;
  padding: 0.85rem 1.15rem;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-text-subtle);
  font-family: ui-monospace, monospace;
  font-size: 0.775rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

[data-theme="light"] .admin-table th {
  background: rgba(0, 0, 0, 0.04);
}

.admin-table td {
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-text);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: var(--admin-card-hover);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

/* -------------------------------------------------------------
   MEDIA UPLOADER
   ------------------------------------------------------------- */
.dropzone {
  border: 2px dashed var(--admin-border-light);
  border-radius: 14px;
  padding: 3rem 1.75rem;
  text-align: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.15);
  transition: all 0.25s ease;
}

[data-theme="light"] .dropzone {
  background: rgba(255, 255, 255, 0.5);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--admin-primary);
  background: rgba(99, 102, 241, 0.08);
}

.media-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.35rem;
  margin-top: 1.75rem;
}

.media-item {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  overflow: hidden;
  padding: 0.85rem;
}

[data-theme="light"] .media-item {
  background: rgba(255, 255, 255, 0.8);
}

/* -------------------------------------------------------------
   RESPONSIVE ADMIN
   ------------------------------------------------------------- */
@media (max-width: 900px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
  }

  .admin-topbar {
    padding: 0 1.25rem;
  }

  .admin-content {
    padding: 1.5rem 1.25rem;
  }

  .admin-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  .panel-card {
    padding: 1.25rem;
  }

  .panel-card-header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.85rem;
  }
}

@media (max-width: 560px) {
  .admin-topbar {
    height: auto;
    min-height: 4.25rem;
    padding: 0.75rem 1rem;
  }

  .topbar-title {
    font-size: 1rem;
  }

  .admin-content {
    padding: 1rem 0.75rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------------------
   TRANSPARENCY PRESETS & ATTACHMENT BADGES
   ------------------------------------------------------------- */
.btn-xs {
  padding: 0.25rem 0.65rem;
  font-size: 0.76rem;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-trans-preset-btn {
  background: var(--admin-bg);
  border: 1px solid var(--admin-border);
  color: var(--admin-text-muted);
  cursor: pointer;
}

.nav-trans-preset-btn:hover {
  border-color: var(--admin-primary);
  color: var(--admin-text);
  background: var(--admin-card-hover);
}

.nav-trans-preset-btn.active-preset {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--admin-primary);
  color: var(--admin-accent);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
}

.cert-file-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-family: var(--font-mono, monospace);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(52, 211, 153, 0.12);
  color: var(--admin-accent);
  border: 1px solid rgba(52, 211, 153, 0.3);
  text-decoration: none;
}

.cert-file-badge:hover {
  background: rgba(52, 211, 153, 0.22);
  text-decoration: underline;
}

.cert-file-missing {
  color: var(--admin-text-subtle);
  font-size: 0.75rem;
  font-style: italic;
}

