/* ==========================================================================
   D. Watson Content Management Studio - Admin Stylesheet
   Zero-Code Visual Editor with Secure Client-Side Authentication Guard
   ========================================================================== */

:root {
  --admin-sidebar-bg: #0F172A;
  --admin-sidebar-text: #94A3B8;
  --admin-sidebar-hover: #1E293B;
  --admin-accent: #DC2626;
  --admin-blue: #1D4ED8;
  --admin-bg: #F8FAFC;
  --admin-surface: #FFFFFF;
  --admin-border: #E2E8F0;
  --admin-text: #0F172A;
  --admin-radius: 12px;
}

body.admin-body {
  background: var(--admin-bg);
  color: var(--admin-text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  min-height: 100vh;
  display: flex;
  margin: 0;
  padding: 0;
}

/* ==========================================================================
   AUTHENTICATION / LOGIN SCREEN OVERLAY
   ========================================================================== */
.admin-auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top right, #1E293B, #0F172A 80%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.admin-auth-overlay.authenticated {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  text-align: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #DC2626, #1D4ED8);
}

.auth-logo {
  height: 52px;
  max-width: 210px;
  margin: 0 auto 16px;
  display: block;
  object-fit: contain;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(220, 38, 38, 0.08);
  color: #DC2626;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 9999px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.auth-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0F172A;
  margin-bottom: 6px;
}

.auth-sub {
  font-size: 0.88rem;
  color: #64748B;
  margin-bottom: 24px;
}

.auth-input-group {
  text-align: left;
  margin-bottom: 16px;
  position: relative;
}

.auth-input-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--admin-border);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  background: #F8FAFC;
  transition: all 0.2s ease;
}

.auth-input:focus {
  background: #FFFFFF;
  border-color: var(--admin-blue);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

.password-toggle-btn {
  position: absolute;
  right: 14px;
  top: 38px;
  color: #94A3B8;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 1rem;
}

.password-toggle-btn:hover {
  color: #0F172A;
}

.auth-btn {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  background: #DC2626;
  color: white;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 20px -5px rgba(220, 38, 38, 0.4);
  transition: all 0.2s ease;
  margin-top: 8px;
}

.auth-btn:hover {
  background: #B91C1C;
  transform: translateY(-2px);
  box-shadow: 0 14px 25px -5px rgba(220, 38, 38, 0.5);
}

.auth-error {
  display: none;
  background: #FEE2E2;
  color: #DC2626;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.auth-error.show {
  display: block;
}

.auth-hint {
  font-size: 0.8rem;
  color: #94A3B8;
  margin-top: 18px;
}

/* ==========================================================================
   Admin Layout & Sidebar
   ========================================================================== */
.admin-sidebar {
  width: 280px;
  background: var(--admin-sidebar-bg);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-header img,
.admin-sidebar-logo {
  height: 38px;
  max-width: 170px;
  background: #FFFFFF;
  padding: 4px 10px;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-nav {
  padding: 20px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-category-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #64748B;
  letter-spacing: 1px;
  padding: 12px 12px 6px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--admin-sidebar-text);
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.admin-nav-item:hover {
  background: var(--admin-sidebar-hover);
  color: #FFFFFF;
}

.admin-nav-item.active {
  background: var(--admin-accent);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* User status bar */
.admin-user-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  font-size: 0.8rem;
  color: #CBD5E1;
}

/* Admin Main Content */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

.admin-topbar {
  background: var(--admin-surface);
  border-bottom: 1px solid var(--admin-border);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-title-wrap h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--admin-text);
}

.admin-title-wrap p {
  font-size: 0.85rem;
  color: #64748B;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-content-area {
  padding: 32px;
  flex: 1;
}

/* Content Tab Sections */
.admin-tab-pane {
  display: none;
}

.admin-tab-pane.active {
  display: block;
}

/* Card & Panels */
.admin-card {
  background: var(--admin-surface);
  border-radius: var(--admin-radius);
  border: 1px solid var(--admin-border);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  padding: 28px;
  margin-bottom: 24px;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--admin-text);
}

/* Slides & Branches List Items */
.items-list-grid {
  display: grid;
  gap: 16px;
}

.editable-item-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  background: #F8FAFC;
  border-radius: 10px;
  border: 1px solid var(--admin-border);
  transition: all 0.2s ease;
}

.editable-item-card:hover {
  border-color: #CBD5E1;
  background: #FFFFFF;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.item-thumbnail {
  width: 90px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #E2E8F0;
}

.item-info {
  flex: 1;
}

.item-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--admin-text);
  margin-bottom: 2px;
}

.item-sub {
  font-size: 0.82rem;
  color: #64748B;
}

.item-actions {
  display: flex;
  gap: 8px;
}

/* Admin Forms & Inputs */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.admin-form-group {
  margin-bottom: 18px;
}

.admin-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #334155;
}

.admin-form-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  font-size: 0.92rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
  background: #FFFFFF;
}

.admin-form-input:focus {
  border-color: var(--admin-blue);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

/* Modal Popup */
.admin-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.admin-modal.active {
  opacity: 1;
  visibility: visible;
}

.admin-modal-box {
  background: #FFFFFF;
  border-radius: 16px;
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.admin-modal.active .admin-modal-box {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--admin-border);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close-btn {
  font-size: 1.4rem;
  color: #64748B;
  cursor: pointer;
}

.modal-close-btn:hover {
  color: var(--admin-accent);
}

/* Toast Notifications */
.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0F172A;
  color: white;
  padding: 14px 22px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 3000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}

.admin-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.admin-toast.success {
  background: #059669;
}

.admin-toast.error {
  background: #DC2626;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS & OFF-CANVAS DRAWER FOR ADMIN STUDIO
   ========================================================================== */
.admin-mobile-header {
  display: none;
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background: #0F172A;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.admin-mobile-toggle-btn,
.admin-mobile-action-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.admin-mobile-toggle-btn:active,
.admin-mobile-action-btn:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.15);
}

.admin-mobile-logo {
  height: 34px;
  max-width: 140px;
  background: #FFFFFF;
  padding: 3px 8px;
  border-radius: 6px;
  object-fit: contain;
}

.admin-sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #94A3B8;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
}

.admin-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.admin-drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Responsive Breakpoints for Admin Studio (Tablets & Mobile Phones) */
@media (max-width: 992px) {
  body.admin-body {
    flex-direction: column;
    min-height: 100vh;
  }

  .admin-mobile-header {
    display: flex;
  }

  .admin-sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .admin-drawer-backdrop {
    display: block;
  }

  .sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 290px;
    max-width: 85vw;
    height: 100vh;
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
  }

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

  .admin-main {
    width: 100%;
    min-height: calc(100vh - 64px);
  }

  .admin-topbar {
    padding: 16px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .admin-title-wrap h1 {
    font-size: 1.35rem;
  }

  .admin-title-wrap p {
    font-size: 0.82rem;
  }

  .admin-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .admin-actions .btn {
    flex: 1;
    min-width: 110px;
    text-align: center;
    justify-content: center;
  }

  .admin-content-area {
    padding: 16px 14px 40px;
  }

  .admin-card {
    padding: 20px 16px;
    border-radius: 14px;
  }

  .card-header-flex {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .card-header-flex .btn {
    width: 100%;
    justify-content: center;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .editable-item-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 14px;
  }

  .item-thumbnail {
    width: 100%;
    height: 140px;
    object-fit: cover;
  }

  .item-info {
    width: 100%;
  }

  .item-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .item-actions .btn,
  .item-actions a {
    flex: 1;
    min-width: 90px;
    justify-content: center;
    text-align: center;
  }

  .admin-modal-box {
    width: 95%;
    max-height: 94vh;
    padding: 20px 16px;
    border-radius: 16px;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 28px 18px;
    border-radius: 16px;
  }

  .auth-title {
    font-size: 1.25rem;
  }

  .admin-toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    font-size: 0.85rem;
    padding: 12px 16px;
    border-radius: 12px;
  }
}
