/* ============================================================
   AirTech Engineering — Admin Panel (Light Theme)
   ============================================================ */

:root {
  --ad-navy:     #0A2A66;
  --ad-blue:     #1565C0;
  --ad-blue-lt:  #E8F0FE;
  --ad-gold:     #F5A623;
  --ad-gold-dk:  #D4881A;
  --ad-bg:       #F2F5FB;
  --ad-white:    #FFFFFF;
  --ad-border:   #DDE3EF;
  --ad-text:     #1A202C;
  --ad-muted:    #64748B;
  --ad-success:  #166534;
  --ad-success-bg: #DCFCE7;
  --ad-error:    #991B1B;
  --ad-error-bg: #FEE2E2;
  --ad-sidebar-w: 240px;
}

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

.admin-body {
  background: var(--ad-bg);
  color: var(--ad-text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.admin-sidebar {
  width: var(--ad-sidebar-w);
  min-height: 100vh;
  background: var(--ad-navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(10,42,102,.18);
}

.admin-sidebar__brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-sidebar__logo-box {
  background: #fff;
  border-radius: 16px;
  padding: 14px 18px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.admin-sidebar__logo-box img { height: 46px; width: auto; max-width: 100%; }

.admin-nav {
  padding: 20px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-nav__label {
  color: rgba(255,255,255,.35);
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 10px 8px 6px;
  margin-top: 8px;
}

.admin-nav__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.admin-nav__link svg { width: 18px; height: 18px; flex-shrink: 0; fill: currentColor; }
.admin-nav__link:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.admin-nav__link.is-active {
  background: var(--ad-blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(21,101,192,.4);
}

.admin-sidebar__footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.admin-sidebar__footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.admin-sidebar__footer a svg { width: 16px; height: 16px; fill: currentColor; }
.admin-sidebar__footer a:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ============================================================
   MAIN AREA
   ============================================================ */
.admin-wrapper {
  margin-left: var(--ad-sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  background: var(--ad-white);
  border-bottom: 1px solid var(--ad-border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-topbar__left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

/* Hamburger (3-line) menu — hidden on desktop */
.admin-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0 9px;
  border: 1px solid var(--ad-border);
  border-radius: 10px;
  background: var(--ad-blue-lt);
  cursor: pointer;
  flex-shrink: 0;
}
.admin-burger span {
  display: block;
  height: 2.5px;
  width: 100%;
  background: var(--ad-navy);
  border-radius: 3px;
  transition: transform .25s, opacity .2s;
}
.admin-burger.is-active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.admin-burger.is-active span:nth-child(2) { opacity: 0; }
.admin-burger.is-active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* Mobile backdrop behind the slide-in sidebar */
.admin-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,42,102,.45);
  z-index: 90;
  opacity: 0;
  transition: opacity .25s;
}
.admin-backdrop.is-open { opacity: 1; }
.admin-topbar__title {
  font-family: "Big Shoulders Display", sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ad-navy);
}
.admin-topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-topbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  font-weight: 700;
  color: var(--ad-muted);
}
.admin-topbar__user-avatar {
  width: 34px; height: 34px;
  background: var(--ad-blue);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: .8rem;
  font-weight: 800;
}

.admin-main {
  flex: 1;
  padding: 28px;
  max-width: 1100px;
  width: 100%;
}

/* ============================================================
   CARDS
   ============================================================ */
.admin-card {
  background: var(--ad-white);
  border: 1px solid var(--ad-border);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px rgba(10,42,102,.05);
}
.admin-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ad-border);
}
.admin-card__head h2 {
  font-family: "Big Shoulders Display", sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ad-navy);
  flex: 1;
}
.admin-card__icon {
  width: 36px; height: 36px;
  background: var(--ad-blue-lt);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--ad-blue);
}
.admin-card__icon svg { width: 18px; height: 18px; fill: currentColor; }

.admin-count {
  background: var(--ad-blue);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 100px;
}
.admin-muted { color: var(--ad-muted); font-size: .9rem; margin-bottom: 18px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: .9rem;
  padding: 10px 20px;
  text-decoration: none;
  transition: transform .14s, box-shadow .14s, filter .14s;
  white-space: nowrap;
}
.admin-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.admin-btn:hover { transform: translateY(-1px); }

.admin-btn--primary {
  background: var(--ad-blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(21,101,192,.3);
}
.admin-btn--primary:hover { filter: brightness(1.08); }

.admin-btn--gold {
  background: linear-gradient(135deg, #F5A623, #D4881A);
  color: #fff;
  box-shadow: 0 4px 14px rgba(212,136,26,.3);
}
.admin-btn--gold:hover { filter: brightness(1.06); }

.admin-btn--ghost {
  background: transparent;
  color: var(--ad-blue);
  border: 1.5px solid var(--ad-blue);
}
.admin-btn--ghost:hover { background: var(--ad-blue-lt); }

.admin-btn--danger {
  background: #FEE2E2;
  color: var(--ad-error);
  border: 1px solid #FECACA;
}
.admin-btn--danger:hover { background: #FECACA; }

.admin-btn--full { width: 100%; justify-content: center; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.admin-field { margin-bottom: 16px; }
.admin-field label {
  display: block;
  font-weight: 700;
  font-size: .82rem;
  color: var(--ad-navy);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.admin-field input[type="text"],
.admin-field input[type="email"],
.admin-field input[type="tel"],
.admin-field input[type="password"],
.admin-field textarea,
.admin-field select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--ad-border);
  border-radius: 10px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--ad-text);
  background: #FAFBFF;
  transition: border-color .15s, box-shadow .15s;
}
.admin-field input:focus,
.admin-field textarea:focus,
.admin-field select:focus {
  outline: none;
  border-color: var(--ad-blue);
  box-shadow: 0 0 0 3px rgba(21,101,192,.12);
  background: #fff;
}
.admin-field textarea { resize: vertical; min-height: 80px; }
.admin-field input[type="file"] {
  width: 100%;
  padding: 16px;
  border: 2px dashed var(--ad-border);
  border-radius: 10px;
  background: #FAFBFF;
  cursor: pointer;
  font-size: .9rem;
  color: var(--ad-muted);
}
.admin-field input[type="file"]:hover { border-color: var(--ad-blue); }
.admin-field__hint { font-size: .78rem; color: var(--ad-muted); margin-top: 4px; }

.admin-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .admin-form-row { grid-template-columns: 1fr; } }

/* ============================================================
   UPLOAD SECTION
   ============================================================ */
.admin-upload-area {
  border: 2px dashed var(--ad-border);
  border-radius: 14px;
  padding: 2rem;
  text-align: center;
  background: #FAFBFF;
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.admin-upload-area:hover { border-color: var(--ad-blue); background: var(--ad-blue-lt); }
.admin-upload-area svg { color: var(--ad-muted); margin-bottom: 8px; }
.admin-upload-area p { color: var(--ad-muted); font-size: .9rem; margin: 0; }
.admin-upload-area strong { color: var(--ad-blue); }

/* ============================================================
   GALLERY GRID
   ============================================================ */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.admin-tile {
  background: var(--ad-white);
  border: 1px solid var(--ad-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(10,42,102,.06);
  transition: box-shadow .2s, transform .2s;
}
/* No transform on hover: a transformed ancestor would trap the fixed-position
   edit modal and clip it. Shadow-only hover keeps the modal anchored to the viewport. */
.admin-tile:hover { box-shadow: 0 6px 20px rgba(10,42,102,.12); }

.admin-tile__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--ad-bg);
  overflow: hidden;
}
.admin-tile__media img,
.admin-tile__media video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.admin-tile__badge {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--ad-navy);
  color: #fff;
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 6px;
}

.admin-tile__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--ad-border);
}
.admin-tile__title {
  font-size: .78rem;
  color: var(--ad-text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-tile__actions { display: flex; align-items: center; gap: 5px; }

.admin-tile__del {
  width: 28px; height: 28px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  background: #FEE2E2;
  color: var(--ad-error);
  font-size: 1.1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background .14s, color .14s;
}
.admin-tile__del:hover { background: #FCA5A5; }

/* Download button on a tile */
.admin-tile__dl {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--ad-blue-lt);
  color: var(--ad-blue);
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: background .14s;
}
.admin-tile__dl:hover { background: #c7d7ff; }

/* Document tile (PDF/Word/Excel…) — a clickable file card */
.admin-tile__doc {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%; width: 100%;
  color: var(--ad-navy);
  text-decoration: none;
  background: linear-gradient(180deg, #f4f7ff, #e6ecfa);
}
.admin-tile__doc:hover { background: #e0e8f8; }
.admin-tile__doc-ext {
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--ad-blue);
}

.admin-tile__edit-btn {
  width: 28px; height: 28px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  background: var(--ad-blue-lt);
  color: var(--ad-blue);
  font-size: .85rem;
  line-height: 1;
  display: grid;
  place-items: center;
  list-style: none;
  transition: background .14s;
}
.admin-tile__edit-btn::-webkit-details-marker { display: none; }
.admin-tile__edit-btn::marker { content: ""; }

.admin-edit[open] .admin-tile__edit-btn { background: var(--ad-blue); color: #fff; }

/* Dimmed backdrop behind the open edit dialog */
.admin-edit[open]::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(10, 42, 102, .5);
  z-index: 900;
}

/* Edit form as a centered modal dialog (always fully visible on desktop & mobile) */
.admin-edit__form {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  z-index: 901;
  background: var(--ad-white);
  border: 1px solid var(--ad-border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 24px 70px rgba(10, 42, 102, .35);
}

.admin-edit__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.admin-edit__head h3 {
  margin: 0;
  font-size: .98rem;
  font-weight: 800;
  color: var(--ad-navy);
}
.admin-edit__close {
  width: 30px; height: 30px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  background: #FEE2E2;
  color: var(--ad-error);
  font-size: 1.25rem;
  line-height: 1;
  display: grid;
  place-items: center;
}
.admin-edit__close:hover { background: #FCA5A5; }
.admin-edit__form label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  margin: 8px 0 4px;
  color: var(--ad-navy);
  text-transform: uppercase;
}
.admin-edit__form input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--ad-border);
  border-radius: 8px;
  font-size: .85rem;
  font-family: inherit;
  background: #FAFBFF;
  color: var(--ad-text);
}
.admin-edit__form input[type="text"]:focus { outline: none; border-color: var(--ad-blue); }
.admin-edit__form input[type="file"] { width: 100%; font-size: .76rem; margin-top: 2px; color: var(--ad-muted); }
.admin-edit__save { width: 100%; margin-top: 10px; padding: 9px; font-size: .82rem; }

/* ============================================================
   ALERTS
   ============================================================ */
.admin-alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.admin-alert--ok {
  background: var(--ad-success-bg);
  color: var(--ad-success);
  border: 1px solid #86EFAC;
}
.admin-alert--error {
  background: var(--ad-error-bg);
  color: var(--ad-error);
  border: 1px solid #FECACA;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.admin-body--login {
  background: linear-gradient(135deg, #0A2A66 0%, #1565C0 100%);
  display: block;
  min-height: 100vh;
}

.admin-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.admin-login {
  width: 100%;
  max-width: 420px;
  background: var(--ad-white);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 24px 80px rgba(0,0,0,.3);
}

.admin-login__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  text-decoration: none;
}
.admin-login__logo img { height: 44px; }
.admin-login__logo-text { line-height: 1.2; }
.admin-login__logo-text strong { display: block; font-size: .85rem; font-weight: 800; color: var(--ad-navy); text-transform: uppercase; letter-spacing: .4px; }
.admin-login__logo-text span { display: block; font-size: .7rem; color: var(--ad-muted); font-weight: 600; }

.admin-login__title {
  font-family: "Big Shoulders Display", sans-serif;
  font-size: 2rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--ad-navy);
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.admin-login__sub { color: var(--ad-muted); font-size: .92rem; margin-bottom: 28px; }

.admin-login .admin-field label { color: var(--ad-muted); }
.admin-login .admin-btn--primary { margin-top: 8px; }

.admin-login__back {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  color: var(--ad-blue);
  font-size: .88rem;
  font-weight: 700;
  text-decoration: none;
}
.admin-login__back:hover { text-decoration: underline; }

/* ============================================================
   SETTINGS SECTION
   ============================================================ */
.settings-group {
  margin-bottom: 28px;
}
.settings-group__title {
  font-size: .72rem;
  font-weight: 800;
  color: var(--ad-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ad-border);
}

/* ============================================================
   STAT CHIPS (dashboard overview)
   ============================================================ */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.admin-stat {
  background: var(--ad-white);
  border: 1px solid var(--ad-border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(10,42,102,.05);
}
.admin-stat__label { font-size: .78rem; font-weight: 700; color: var(--ad-muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.admin-stat__val { font-family: "Big Shoulders Display", sans-serif; font-size: 2rem; font-weight: 900; color: var(--ad-navy); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform .25s; z-index: 100; }
  .admin-sidebar.is-open { transform: translateX(0); }
  .admin-wrapper { margin-left: 0; }
  .admin-main { padding: 18px; }

  /* Mobile topbar */
  .admin-topbar { padding: 12px 16px; }
  .admin-topbar__title { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .admin-burger { display: flex; }
  .admin-backdrop { display: block; }

  /* Slim the avatar/name on small screens */
  .admin-topbar__user-name { display: none; }
}

@media (max-width: 420px) {
  .admin-topbar__title { font-size: .98rem; }
}
