/* ===================================================
   Deals4all.ai – Admin / Shared Styles (style.css)
   Design System v2: Navy #0F172A | Orange #F97316
   =================================================== */

:root {
  --theme-accent:       #F97316;
  --theme-accent-light: #FFF7ED;
  --theme-accent-dark:  #EA6C0A;
  --navy:               #0F172A;
  --navy-light:         #1E293B;
  --bg:                 #F8FAFC;
  --surface:            #FFFFFF;
  --border:             #E2E8F0;
  --text:               #1E293B;
  --text-muted:         #64748B;
}

body {
  margin: 0;
  font-family: 'Inter', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: margin-left 0.3s;
  -webkit-font-smoothing: antialiased;
}

.main-content {
  margin-left: 240px;
  transition: margin-left 0.3s;
}

/* ---- Admin Header ---- */
header {
  background: var(--navy);
  padding: 0 1.5em;
  color: #fff;
  font-size: 1.3em;
  font-weight: 800;
  height: 60px;
  display: flex;
  align-items: center;
  letter-spacing: -0.01em;
}

/* ---- Theme picker ---- */
.theme-picker {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin: 1em auto;
  max-width: 600px;
  padding-left: 0.3em;
}
.theme-picker label {
  font-weight: 600;
  color: var(--theme-accent);
}
.theme-picker input[type="color"] {
  width: 36px; height: 36px; border: none; cursor: pointer; background: transparent;
}

/* ---- Top Nav (admin) ---- */
.top-nav {
  top: 0; left: 0; right: 0;
  z-index: 1100;
  width: 100%;
  background: var(--surface);
  margin-bottom: 1em;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.top-nav a {
  padding: 0.9em 1.2em;
  color: var(--theme-accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.93em;
  border-radius: 6px;
  transition: background 0.15s;
}

.top-nav a:hover {
  background: var(--theme-accent-light);
}

.top-nav a.active {
  color: var(--theme-accent-dark);
  font-weight: 700;
}

main { padding: 1.5em 1em; }

/* ---- Landing / admin content box ---- */
.landing {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 1.2em;
}

/* ---- Search ---- */
#searchForm {
  z-index: 1099;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 0.8em 1em;
  border-bottom: 1px solid var(--border);
}

#searchInput {
  flex: 1;
  padding: 0.65em 0.9em;
  font-size: 0.95em;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}
#searchInput:focus { border-color: var(--theme-accent); }

#searchForm button {
  padding: 0.65em 1.2em;
  background: var(--theme-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.93em;
}
#searchForm button:hover { background: var(--theme-accent-dark); }

#searchResults { margin-top: 1em; }

.search-item {
  border-bottom: 1px solid var(--border);
  padding: 0.65em 0;
  font-size: 0.93em;
}

/* ---- Featured Category Section ---- */
.featured-category-section {
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border-radius: 12px;
  border: 1px solid var(--border);
  margin: 1.5em auto;
  max-width: 820px;
  padding: 1.2em 1em;
}

.featured-category-section h2 {
  margin-bottom: 0.9em;
  font-size: 1.15em;
  color: var(--theme-accent);
  font-weight: 700;
  text-align: left;
}

.featured-cards {
  display: grid;
  gap: 0.6em;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
}

.featured-card {
  background: var(--theme-accent-light);
  border-radius: 8px;
  padding: 0.8em;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 1px 4px rgba(249,115,22,0.10);
  transition: box-shadow 0.17s;
  border: 1px solid rgba(249,115,22,0.15);
}

.featured-card:hover { box-shadow: 0 3px 12px rgba(249,115,22,0.18); }

.featured-card img {
  width: 220px;
  height: 220px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.5em;
  background: #fff;
}

.featured-title {
  font-size: 1em;
  font-weight: 700;
  margin-bottom: 0.25em;
  color: var(--theme-accent);
  text-align: center;
}

.featured-desc { font-size: 0.9em; color: var(--text-muted); margin-bottom: 0.4em; text-align: center; }

.featured-link {
  margin-top: 0.2em;
  font-size: 0.88em;
  color: var(--theme-accent);
  background: var(--theme-accent-light);
  padding: 0.2em 0.7em;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.15s;
  border: 1px solid rgba(249,115,22,0.30);
}
.featured-link:hover { background: #FDE8D2; }

/* ---- Product Slider ---- */
.product-slider-section {
  margin-top: 1.5em;
  padding: 1em;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  border: 1px solid var(--border);
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}

.slider-container {
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.product-slider {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  gap: 0.8em;
  padding: 0.5em 0;
  scrollbar-width: none;
}
.product-slider::-webkit-scrollbar { display: none; }

.product-card {
  min-width: 120px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8em;
  text-align: center;
  font-size: 0.95em;
  flex: 0 0 auto;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: transform 0.18s, box-shadow 0.18s;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.product-card span {
  display: block;
  font-size: 0.88em;
  color: var(--theme-accent);
  margin-top: 0.3em;
  font-weight: 600;
}

.slider-btn {
  background: var(--theme-accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 1.2em;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: background 0.2s;
  flex-shrink: 0;
}
.slider-btn:hover { background: var(--theme-accent-dark); }

/* ===== ADMIN SIDEBAR ===== */
.sidebar {
  width: 240px;
  background: var(--surface);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 2000;
  box-shadow: 2px 0 12px rgba(0,0,0,0.06);
  border-right: 1px solid var(--border);
  padding-top: 60px;
  transition: transform 0.3s;
  overflow: hidden;
}

.sidebar-header {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  background: var(--navy);
  color: #fff;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 1em;
  font-size: 1em;
  font-weight: 700;
  z-index: 2;
}

.sidebar-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6em;
  cursor: pointer;
  margin-right: 0.6em;
  line-height: 1;
}

.sidebar-header span { flex: 1; margin-left: 0.2em; }

.sidebar-toggle {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5em;
  cursor: pointer;
  margin-left: 0.5em;
  display: none;
}

.category-list {
  list-style: none;
  margin: 0;
  padding: 0.5em;
  overflow-y: auto;
  height: calc(100vh - 60px);
}

.category-list li { margin: 0.25em 0; }

.category-list a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92em;
  padding: 0.5em 0.8em;
  display: block;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.category-list a:hover,
.category-list a.active {
  background: var(--theme-accent-light);
  color: var(--theme-accent);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  background: rgba(15,23,42,0.30);
  z-index: 1500;
  transition: opacity 0.18s;
}

/* Responsive sidebar */
@media (max-width: 900px) {
  .sidebar-toggle { display: block; }
  .sidebar-close  { display: inline-block; }
  .sidebar {
    transform: translateX(-100%);
    width: 210px;
    position: fixed;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.14);
  }
  .main-content { margin-left: 0 !important; }
}

@media (min-width: 901px) {
  .sidebar-toggle { display: none; }
  .sidebar-close  { display: inline-block; }
  .sidebar {
    transform: none;
    width: 240px;
    position: fixed;
  }
  .main-content { margin-left: 240px !important; }
  .sidebar-backdrop { display: none !important; }
}

.sidebar.hidden { display: none !important; }
.main-content.full { margin-left: 0 !important; }

@media (max-width: 600px) {
  .sidebar { width: 180px; font-size: 0.93em; padding-top: 52px; }
  .sidebar-header { height: 52px; }
  .category-list { height: calc(100vh - 52px); }
  header, main, .landing { padding: 0.8em; }
  .featured-category-section { padding: 0.8em 0.5em; }
  .featured-cards { grid-template-columns: 1fr; }
  .product-slider-section { padding: 0.5em; }
  .product-card { min-width: 100px; }
  .slider-btn { width: 28px; height: 28px; font-size: 1em; }
}

/* ===== ADMIN SIDEBAR (admin_sidebar.php) ===== */
.admin-sidebar {
  width: 240px;
  background: var(--navy, #0F172A);
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform 0.3s;
  box-shadow: 2px 0 12px rgba(0,0,0,0.18);
}

.admin-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  height: 60px;
  background: rgba(0,0,0,0.18);
  flex-shrink: 0;
}

.admin-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
}

.admin-sidebar-logo-badge {
  background: var(--theme-accent, #F97316);
  color: #fff;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.02em;
}

.admin-sidebar-logo-text {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: rgba(255,255,255,0.88);
}

.admin-sidebar-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  display: none;
}
.admin-sidebar-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.admin-sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.admin-sidebar-avatar {
  width: 36px; height: 36px;
  background: var(--theme-accent, #F97316);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.95rem;
  flex-shrink: 0;
}

.admin-sidebar-user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-sidebar-username {
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-sidebar-role {
  font-size: 0.73rem;
  color: rgba(255,255,255,0.50);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.admin-sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  padding: 10px 8px 4px;
  margin-top: 4px;
}

.admin-sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
  cursor: pointer;
}

.admin-sidebar-link:hover {
  background: rgba(255,255,255,0.09);
  color: #fff;
}

.admin-sidebar-link.active {
  background: var(--theme-accent, #F97316);
  color: #fff;
  font-weight: 700;
}

.admin-sidebar-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.admin-sidebar-link-text { flex: 1; }

.admin-sidebar-badge {
  background: #EF4444;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.5;
}

.admin-sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 8px 8px;
}

.admin-sidebar-logout {
  color: rgba(255,100,100,0.80);
}
.admin-sidebar-logout:hover {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
}

.admin-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.40);
  z-index: 1900;
}
.admin-sidebar-backdrop.visible { display: block; }

/* Mobile toggle button injected by JS */
.admin-sidebar-mobile-toggle {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 1800;
  background: var(--navy, #0F172A);
  color: #fff;
  border: none;
  border-radius: 7px;
  width: 38px; height: 38px;
  font-size: 1.25rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.22);
}

/* Responsive */
@media (max-width: 900px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-sidebar-close { display: flex; }
  .main-content.admin-content { margin-left: 0 !important; }
  .admin-sidebar-mobile-toggle { display: flex; }
}

@media (min-width: 901px) {
  .admin-sidebar { transform: none; }
  .admin-sidebar-close { display: none; }
  .main-content.admin-content { margin-left: 240px !important; }
  .admin-sidebar-backdrop { display: none !important; }
  .admin-sidebar-mobile-toggle { display: none !important; }
}

/* ---- Admin Main Header (replaces bare <header> in admin context) ---- */
.admin-main-header {
  background: var(--navy);
  padding: 0 1.5em;
  color: #fff;
  font-size: 1.3em;
  font-weight: 800;
  height: 60px;
  display: flex;
  align-items: center;
  letter-spacing: -0.01em;
  gap: 0;
}

/* On mobile, add left padding so the hamburger toggle doesn't overlap the logo */
@media (max-width: 900px) {
  .admin-main-header {
    padding-left: 60px;
  }
}

/* ---- Footer ---- */
footer {
  background: var(--navy);
  color: rgba(255,255,255,0.75);
  text-align: center;
  padding: 1.2em 0;
  margin-top: 2em;
  font-size: 0.9em;
}
footer a { color: rgba(255,255,255,0.75); }
footer a:hover { color: #fff; }