:root{
  --primary:#2D3277;
  --accent:#00A650;
  --danger:#e74c3c;
  --warning:#f39c12;
  --success:#27ae60;
  --bg:#f6f7fb;
  --card:#fff;
  --border:#e0e0e0;
  --text:#222;
  --muted:#666;
  --light-gray:#f5f5f5;
  --shadow-sm:0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:0 4px 16px rgba(0,0,0,0.12);
  --transition:all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 1.5rem 0 1rem;
  color: var(--primary);
  line-height: 1.2;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.5rem; }

p { margin: 1rem 0; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: #008f45;
  text-decoration: underline;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* HEADER */
.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, #1a1d4d 100%);
  color: #fff;
  padding: 3rem 0;
  position: relative;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  transform: translate(50%, -50%);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

.header-main h1 {
  margin: 0;
  font-size: 2.5rem;
  color: #fff;
}

.tagline {
  opacity: 0.9;
  margin: 0.5rem 0 0;
  font-size: 1.1rem;
}

.admin-link {
  position: relative;
}

.admin-link a {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-weight: 500;
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.admin-link a:hover {
  background: rgba(255, 255, 255, 0.25);
  text-decoration: none;
}

/* BREADCRUMB */
.breadcrumb {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 0;
  font-size: 0.9rem;
}

.breadcrumb a {
  color: var(--accent);
  font-weight: 500;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* MAIN LAYOUT */
.main-content {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  padding: 2rem 1rem;
  min-height: calc(100vh - 300px);
}

/* SIDEBAR */
.sidebar {
  position: relative;
}

.sidebar-sticky {
  position: sticky;
  top: 20px;
}

.sidebar h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
  color: var(--primary);
}

.category-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.category-link {
  display: flex;
  align-items: center;
  padding: 0.8rem 1rem;
  color: var(--text);
  background: var(--card);
  border-radius: 6px;
  border-left: 3px solid transparent;
  transition: var(--transition);
  font-weight: 500;
}

.category-link:hover {
  background: var(--light-gray);
  text-decoration: none;
  border-left-color: var(--accent);
  transform: translateX(4px);
}

.category-link.active {
  background: rgba(0, 166, 80, 0.1);
  color: var(--accent);
  border-left-color: var(--accent);
}

.category-link .icon {
  margin-right: 0.5rem;
  font-size: 1.2em;
}

.category-link .count {
  margin-left: auto;
  background: var(--light-gray);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--muted);
  font-weight: normal;
}

.category-link.active .count {
  background: rgba(0, 166, 80, 0.2);
  color: var(--accent);
}

/* STATS WIDGET */
.stats-widget {
  background: var(--card);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.stats-widget h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-item .label {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-item .value {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--accent);
}

/* OFFERS SECTION */
.offers-section {
  flex: 1;
}

.offers-header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.offers-title {
  margin: 0;
  font-size: 2rem;
  color: var(--primary);
}

.offers-desc {
  color: var(--muted);
  margin: 0.5rem 0 0;
  font-size: 1.05rem;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.empty-state h2 {
  color: var(--primary);
}

.empty-state p {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* OFFERS GRID */
.offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* OFFER CARD */
.offer-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border: 1px solid var(--border);
  position: relative;
}

.offer-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.offer-image-container {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--light-gray) 0%, #e8e8e8 100%);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.offer-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.offer-card:hover .offer-image {
  transform: scale(1.05);
}

.offer-image-container.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
}

.offer-placeholder {
  font-size: 3rem;
  opacity: 0.3;
}

.offer-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
}

.offer-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.offer-category {
  display: inline-block;
  background: rgba(0, 166, 80, 0.1);
  color: var(--accent);
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
  width: fit-content;
}

.offer-title {
  margin: 0 0 0.8rem;
  font-size: 1.3rem;
  color: var(--primary);
  line-height: 1.3;
}

.offer-description {
  color: var(--text);
  font-size: 0.95rem;
  margin: 0 0 1rem;
  flex-grow: 1;
  line-height: 1.5;
}

/* OFFER STATS */
.offer-stats {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
  align-items: center;
}

.price-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f9f9f9;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.price-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.price-value {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--accent);
  margin-top: 0.2rem;
}

.engagement-badges {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.engagement-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--light-gray);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.badge-icon {
  font-size: 1.1em;
}

.offer-ctr {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.offer-ctr small {
  display: block;
}

/* BUTTONS */
.btn, .button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: var(--transition);
  text-align: center;
  align-self: flex-start;
}

.btn:hover, .button:hover {
  background: #008f45;
  text-decoration: none;
  transform: translateX(2px);
}

.btn-primary {
  width: 100%;
  align-self: stretch;
}

.btn.secondary, .button.secondary {
  background: #95a5a6;
  color: #fff;
}

.btn.secondary:hover, .button.secondary:hover {
  background: #7f8c8d;
}

.btn.danger, .button.danger {
  background: var(--danger);
}

.btn.danger:hover, .button.danger:hover {
  background: #c0392b;
}

/* FORMS */
form { margin: 1.5rem 0; }
form > div { margin: 0.8rem 0; }

label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
  background: var(--card);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 166, 80, 0.1);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* TABLES */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table th {
  background: var(--primary);
  color: #fff;
  padding: 1rem;
  text-align: left;
  font-weight: 600;
}

table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}

table tr:last-child td {
  border-bottom: none;
}

table tr:hover {
  background: var(--light-gray);
}

table td.actions {
  white-space: nowrap;
  font-size: 0.9rem;
}

table a {
  margin-right: 0.8rem;
}

/* PAGINATION */
.pagination {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--primary);
  transition: var(--transition);
  font-weight: 500;
}

.pagination a:hover {
  background: var(--light-gray);
  border-color: var(--accent);
  color: var(--accent);
}

.pagination span.current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* SEARCH/FILTER */
.filter-bar {
  background: var(--card);
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.filter-bar form { margin: 0; }
.filter-bar > div {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-bar input,
.filter-bar select {
  flex: 1;
  min-width: 200px;
}

/* MESSAGES */
.error, .success, .warning, .info {
  padding: 1.2rem;
  border-radius: 8px;
  margin: 1.5rem 0;
  font-weight: 500;
  border-left: 4px solid;
}

.error {
  background: #fadbd8;
  color: #c0392b;
  border-left-color: var(--danger);
}

.success {
  background: #d5f4e6;
  color: #27ae60;
  border-left-color: var(--success);
}

.warning {
  background: #fdebd0;
  color: #d68910;
  border-left-color: var(--warning);
}

.info {
  background: #d6eaf8;
  color: #2471a3;
  border-left-color: #2471a3;
}

/* FOOTER */
.site-footer {
  background: var(--primary);
  color: #fff;
  padding: 3rem 0 1rem;
  margin-top: 4rem;
  border-top: 1px solid var(--border);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
  color: #fff;
  margin-top: 0;
}

.footer-section p {
  opacity: 0.9;
  font-size: 0.95rem;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin: 0.5rem 0;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.8);
  transition: var(--transition);
}

.footer-links a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-bottom {
  text-align: center;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

/* ADMIN UTILITIES */
.card {
  background: var(--card);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  margin: 1.5rem 0;
}

.card h2 { margin-top: 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.stat-box {
  background: var(--card);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  text-align: center;
  border-top: 3px solid var(--accent);
}

.stat-box .number {
  font-size: 2.2rem;
  font-weight: bold;
  color: var(--accent);
  margin: 0.5rem 0;
}

.stat-box .label {
  color: var(--muted);
  font-size: 0.9rem;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 250px 1fr;
    gap: 1.5rem;
  }

  .offers-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  .main-content {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .sidebar-sticky {
    position: static;
  }

  .sidebar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
  }

  .sidebar h2 {
    display: none;
  }

  .category-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .category-link {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  .category-link .count {
    display: none;
  }

  .stats-widget {
    display: none;
  }

  .offers-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .header-main h1 {
    font-size: 2rem;
  }

  .tagline {
    font-size: 1rem;
  }

  .offer-stats {
    flex-direction: column;
    align-items: flex-start;
  }

  .engagement-badges {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 1rem 0.5rem;
  }

  .offers-grid {
    grid-template-columns: 1fr;
  }

  .header-main h1 {
    font-size: 1.5rem;
  }

  .offers-title {
    font-size: 1.5rem;
  }

  .offer-card {
    border-radius: 8px;
  }

  .offer-image-container {
    height: 150px;
  }

  .sidebar {
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .category-nav {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.5rem;
  }

  .category-link {
    white-space: nowrap;
    flex-shrink: 0;
  }
}