  * { box-sizing: border-box; }
 :root {
   /* Futuristic, elegant palette */
   --bg: #F6F8FF; /* page background */
   --bg-elev: #ffffff; /* container/card background */
   --border: #e6ebf3;
   --border-soft: #d7deea;
   --text: #0A1020;
   --text-dim: #4b5570;
   --brand-700: #144a8a;  /* deep azure */
   --brand-500: #2b9ddc;  /* electric blue */
   --accent-500: #7C5CFF; /* violet accent */
   
   /* Premium button gradient */
   --btn-primary-start: #30a3e1; /* top */
   --btn-primary-end: #1762c4;   /* bottom */
   --btn-primary-border: #1759ae;
   --btn-focus: rgba(44,145,222,0.35);

   /* Shadows */
   --shadow-sm: 0 1px 2px rgba(8,15,35,0.06);
   --shadow-md: 0 8px 24px rgba(16, 73, 125, 0.08);
   --shadow-lg: 0 16px 40px rgba(16, 73, 125, 0.12);
 }
  html, body { height: 100%; }
 body { margin: 0; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: var(--text); background:
   radial-gradient(1200px 800px at 0% -10%, rgba(124,92,255,0.06), transparent 60%),
   radial-gradient(1000px 700px at 100% 0%, rgba(43,157,220,0.06), transparent 55%),
   var(--bg);
 }

  /* Layout */
 .site-header, .site-footer { padding: 16px 0; background: rgba(255,255,255,0.75); border-bottom: 1px solid var(--border); backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px); box-shadow: var(--shadow-sm); }
  .site-footer { border-top: 1px solid var(--border); border-bottom: 0; }
  .container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
  .disclosure { color: var(--text-dim); font-size: 12px; }

  /* Top nav */
  .topbar { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap: nowrap; }
  .topbar nav { margin-left: auto; display:flex; gap:10px; align-items:center; }
  .brand-title { margin:0; }

  /* Gutter layout */
  .gutter-layout { padding: 16px 0; }
  .gutter { display:none; }
@media (min-width: 1024px) {
  .gutter-layout { display:grid; grid-template-columns: 150px 1000px 150px; justify-content:center; gap: 20px; }
  .gutter { display:block; }
  .gutter .gutter-box { position: sticky; top: 16px; border: 1px dashed var(--border); background:#ffffff; border-radius:10px; min-height: 600px; }
  .gutter .ad-badge { display:inline-block; margin:8px; font-size:11px; color:#10497D; background:#eef4ff; border:1px solid #cdddf7; padding:2px 6px; border-radius:999px; }
}

  /* Grid & Cards */
  .grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
  @media (min-width: 800px) { .grid { grid-template-columns: repeat(3, 1fr); } }
  @media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, 1fr); } }
 .card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .2s ease, border-color .2s ease; }
 .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #d3dced; }
  .card-image { display: block; width: 100%; height: 220px; background: #f0f3f8; overflow: hidden; }
  .card img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .placeholder { display:flex; align-items:center; justify-content:center; width:100%; height:100%; color: var(--text-dim); }
  .card-title { margin: 12px; font-size: 16px; line-height: 1.3; color: var(--text); }
  .card-actions { margin: 0 12px 12px; }

/* Buttons */
 .btn { 
  display: inline-block; 
  padding: 10px 16px; 
  background: linear-gradient(180deg, var(--btn-primary-start), var(--btn-primary-end)); 
  color: #ffffff; 
  text-decoration: none; 
  border-radius: 10px; 
  border: 1px solid var(--btn-primary-border); 
  font-weight: 600; 
  transition: transform .05s ease, filter .15s ease, box-shadow .15s ease;
  min-width: 80px;
  text-align: center;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 6px 14px rgba(23,89,174,0.18);
}
.btn:hover { 
  filter: brightness(1.03); 
  transform: translateY(-1.5px); 
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 12px 22px rgba(23,89,174,0.22);
}
.btn:active { 
  transform: translateY(0); 
  filter: brightness(0.98);
}
 .btn:focus { 
  outline: none; 
  box-shadow: 0 0 0 3px var(--btn-focus);
}
.btn.secondary { background: #f5f9ff; color: var(--brand-700); border-color: #d3e3f8; box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: #eaf3ff; border-color: #c6ddfb; }
.btn.ghost { background: transparent; color: var(--brand-700); border:1px solid #cfe2f7; }
.btn.ghost:hover { background: rgba(43,157,220,0.06); }
.btn.danger { background: #ffe5e9; color:#7d1f2b; border-color:#f5c6cd; }
.btn[disabled], .btn:disabled { cursor: not-allowed; opacity: .6; transform: none; }

  /* Pagination */
  .pagination { 
    display: flex; 
    flex-direction: column; 
    gap: 16px; 
    align-items: center; 
    margin: 24px 0; 
    color: var(--text-dim); 
  }
  .pagination-info { 
    font-size: 14px; 
    color: var(--text-dim); 
  }
  .pagination-controls { 
    display: flex; 
    gap: 8px; 
    align-items: center; 
    flex-wrap: wrap; 
    justify-content: center; 
  }
  .pagination-controls .btn { 
    min-width: 40px; 
    padding: 8px 12px; 
    font-size: 13px; 
  }
  .pagination-controls .btn.primary { 
    background: var(--brand-500); 
    color: #fff; 
    border-color: var(--brand-700); 
  }

  /* Admin Search and Toolbar */
  .admin-toolbar { 
    display: flex; 
    gap: 16px; 
    align-items: center; 
    margin: 16px 0; 
    flex-wrap: wrap; 
  }
  .search-form { 
    flex: 1; 
    min-width: 300px; 
  }
  .search-form form { 
    display: flex; 
    gap: 8px; 
    align-items: center; 
  }
  .search-input { 
    flex: 1; 
    padding: 10px 16px; 
    background: #ffffff; 
    color: var(--text); 
    border: 1px solid var(--border-soft); 
    border-radius: 8px; 
    font-size: 14px; 
  }
  .search-input:focus { 
    outline: none; 
    border-color: var(--brand-500); 
    box-shadow: 0 0 0 2px rgba(20, 149, 208, 0.2); 
  }
  .search-input::placeholder { 
    color: var(--text-dim); 
  }
  .add-product { 
    flex-shrink: 0; 
  }
  .search-results-info { 
    background: var(--bg-elev); 
    border: 1px solid var(--border-soft); 
    border-radius: 8px; 
    padding: 12px 16px; 
    margin: 16px 0; 
    color: var(--text); 
    font-size: 14px; 
  }
  .search-results-info strong { 
    color: var(--brand-500); 
  }

  /* Ad Slider Styles */
  .ad-slider-container {
    position: relative;
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-elev);
    border: 1px solid var(--border);
  }

  .ad-slider {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
  }

  .ad-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .ad-slide.active {
    opacity: 1;
  }

  .ad-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
  }

  .ad-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

  .ad-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .ad-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 20px;
    color: white;
  }

  .ad-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
  }

  .ad-description {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
  }

  .ad-slider-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 16px;
    pointer-events: none;
  }

  .ad-slider-btn {
    background: rgba(0,0,0,0.5);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
    pointer-events: auto;
  }

  .ad-slider-btn:hover {
    background: rgba(0,0,0,0.7);
  }

  .ad-slider-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
  }

  .ad-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.3s ease;
  }

  .ad-dot.active {
    background: var(--brand-500);
  }

  .ad-dot:hover {
    background: rgba(255,255,255,0.8);
  }

  /* Position-specific styling */
  .ad-slider-container[data-position="header"] {
    margin: 16px auto 0 auto;
    max-width: 1200px;
    height: 400px;
    padding: 0 16px;
  }

  .ad-slider-container[data-position="header"] .ad-slider {
    height: 400px;
  }

  .ad-slider-container[data-position="footer"] {
    margin: 0 auto 20px auto;
    max-width: 1200px;
    height: 400px;
    padding: 0 16px;
  }

  .ad-slider-container[data-position="footer"] .ad-slider {
    height: 400px;
  }

  /* Mobile responsive */
  @media (max-width: 768px) {
    .ad-slider-container {
      margin: 12px 0;
      border-radius: 8px;
    }

    .ad-slider-container[data-position="header"] {
      height: 300px;
      max-width: 100%;
      padding: 0 8px;
    }

    .ad-slider-container[data-position="header"] .ad-slider {
      height: 300px;
    }

    .ad-slider-container[data-position="footer"] {
      height: 300px;
      max-width: 100%;
      padding: 0 8px;
    }

    .ad-slider-container[data-position="footer"] .ad-slider {
      height: 300px;
    }

    .ad-content {
      padding: 12px;
    }

    .ad-title {
      font-size: 16px;
    }

    .ad-description {
      font-size: 12px;
    }

    .ad-slider-btn {
      width: 32px;
      height: 32px;
    }

    .ad-dot {
      width: 10px;
      height: 10px;
    }
  }

  /* Admin ad management styles */
  .position-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
  }

  .position-badge.position-header {
    background: var(--brand-700);
    color: #ffffff;
  }

  .position-badge.position-footer {
    background: var(--brand-500);
    color: #ffffff;
  }

  .ad-form {
    max-width: 800px;
    margin: 0 auto;
  }

  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .form-group {
    margin-bottom: 16px;
  }

  .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    font-size: 14px;
  }

  .form-group input:focus,
  .form-group textarea:focus,
  .form-group select:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 2px rgba(20, 149, 208, 0.2);
  }

  .form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-dim);
    font-size: 12px;
  }

  .form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
  }

  .current-image {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-elev);
    border-radius: 8px;
    border: 1px solid var(--border-soft);
  }

  .current-image p {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: var(--text-dim);
  }

  .form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
  }

  .delete-confirmation {
    max-width: 600px;
    margin: 0 auto;
  }

  .ad-preview {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
  }

  .ad-preview h3 {
    margin: 0 0 12px 0;
    color: var(--text);
  }

  .ad-preview p {
    margin: 8px 0;
    color: var(--text-dim);
  }

  .image-preview {
    margin: 12px 0;
  }

  .image-preview p {
    margin: 0 0 8px 0;
    font-weight: 600;
    color: var(--text);
  }

  @media (max-width: 768px) {
    .form-row {
      grid-template-columns: 1fr;
    }

    .form-actions {
      flex-direction: column;
    }

    .form-actions .btn {
      width: 100%;
    }
  }

  /* Detail */
  .detail { display:grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .detail-media img { width: 100%; border:1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); }
  .back { text-decoration:none; color:var(--brand-500); }

  /* Ads */
  .ad { margin: 16px 0; border-radius: 10px; border:1px dashed var(--border); background: #ffffff; position: relative; }
  .ad.ad-hero { min-height: 90px; display:flex; align-items:center; justify-content:center; }
  .ad.infeed { min-height: 90px; }
  .ad .ad-badge { position:absolute; top:6px; left:6px; font-size:11px; color:#10497D; background:#eef4ff; border:1px solid #cdddf7; padding:2px 6px; border-radius:999px; }
  .ad .ad-placeholder { color:#6f86a0; font-size:13px; padding: 16px; text-align:center; }
  
  /* Header ad specific styling */
  header .ad.ad-hero {
    background: #ffffff;
    border: 2px solid var(--border);
    margin: 0;
    border-radius: 0;
    min-height: 100px;
  }
  
  /* Ad unit styling */
  .adsbygoogle {
    display: block !important;
    width: 100% !important;
  }


/* Tables (admin) */
table { 
  width:100%; 
  border-collapse: separate; 
  border-spacing: 0;
  background: var(--bg-elev); 
  border-radius: 8px; 
  overflow: hidden; 
  border: none !important;
}
th, td { 
  padding:12px; 
  text-align:left; 
  color: var(--text); 
  vertical-align: middle; 
  border: none !important;
  border-bottom: none !important;
  border-right: none !important;
  border-left: none !important;
  border-top: none !important;
}
th { 
  background:#f2f5fa; 
  color:#0b1220; 
  border: none !important;
}
tr:nth-child(even) { background: var(--bg-elev); }
tr:nth-child(odd) { background: #ffffff; }
tr:hover { background: #f7fafc; }
tbody tr { border: none !important; }
tbody td { border: none !important; }
thead tr { border: none !important; }
thead th { border: none !important; }
  .table-thumb { width: 40px; height: 40px; border-radius: 8px; border:1px solid var(--border-soft); object-fit: cover; background:var(--bg-elev); }
  .row-actions .btn { padding:8px 12px; }

  /* Forms (admin) */
  input[type=text], input[type=password], textarea, select { 
    width:100%; 
    padding:12px 16px; 
    background:#ffffff; 
    color: var(--text); 
    border:1px solid var(--border-soft) !important; 
    border-radius:8px; 
    outline: none; 
    font-size: 14px;
    transition: all 0.2s ease;
  }
  input::placeholder, textarea::placeholder { color: var(--text-dim); }
  input[type=text]:focus, input[type=password]:focus, textarea:focus, select:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(20,149,208,0.15);
    outline: none;
    background: #ffffff;
  }

  /* File upload styling */
  input[type=file] {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--border-soft) !important;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  input[type=file]:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(20,149,208,0.15);
    background: #ffffff;
  }
  input[type=file]::file-selector-button {
    background: var(--brand-500);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    margin-right: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
  }
  input[type=file]::file-selector-button:hover {
    background: var(--brand-700);
    transform: translateY(-1px);
  }

  /* Checkbox styling */
  input[type=checkbox] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-500);
    margin-right: 8px;
    cursor: pointer;
  }

  /* Form labels */
  label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
  }

  /* Table row actions */
  .row-actions {
    display: flex !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    align-items: center !important;
  }

  /* TinyMCE styling */
  .tox-tinymce {
    border: 1px solid var(--border-soft) !important;
    border-radius: 8px !important;
    background: #ffffff !important;
  }
  .tox .tox-editor-header {
    background: var(--bg-elev) !important;
    border-bottom: 1px solid var(--border-soft) !important;
  }
  .tox .tox-toolbar {
    background: var(--bg-elev) !important;
  }
  .tox .tox-edit-area__iframe {
    background: #ffffff !important;
  }
  .tox .tox-button {
    color: var(--text) !important;
  }
  .tox .tox-button:hover {
    background: var(--border-soft) !important;
  }

  .form-row { margin-bottom:14px; }
.flash { background:#d4edda; border:1px solid #c3e6cb; padding:10px 12px; border-radius:8px; margin-bottom:12px; color:#155724; }
.flash.success { background:#d4edda; border:1px solid #c3e6cb; color:#155724; }
.error { background:#f8d7da; border:1px solid #f5c6cb; color:#721c24; }

  /* Responsive */
  @media (max-width: 800px) {
    .detail { grid-template-columns: 1fr; }
    .card-image { height: 180px; }
  }
