/* ---------- BASE THEME VARIABLES ---------- */
:root {
  /* Brand tokens */
  --brand-start: #3B82F6;
  --brand-end: #06B6D4;

  /* Light mode variables */
  --bg-color: #ffffff;
  --surface-color: #f8fafc;
  --text-color: #334155;
  --heading-color: #0f172a;
  --muted-text: #64748b;
  --border-color: #f1f5f9;
  --primary-color: #3B82F6;
  --navbar-bg: rgba(255, 255, 255, 0.85);
  --navbar-text: #1e293b;
  
  /* Admin specific */
  --card-shadow: rgba(0, 0, 0, 0.05);
  --danger-color: #ef4444;
  --success-color: #10b981;
  --warning-color: #f59e0b;
}

/* ---------- DARK THEME OVERRIDES ---------- */
body.dark-mode {
  --bg-color: #0B0F1A;
  --surface-color: #151b2b;
  --text-color: #cbd5e1;
  --heading-color: #f1f5f9;
  --muted-text: #94a3b8;
  --border-color: #1e293b;
  --navbar-bg: rgba(11, 15, 26, 0.85);
  --navbar-text: #f1f5f9;
  --card-shadow: rgba(0, 0, 0, 0.2);
}

/* ---------- GLOBAL STYLES ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  padding-top: 70px;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: var(--heading-color);
  font-weight: 700;
  line-height: 1.2;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-color);
}

/* ---------- NAVBAR ---------- */
.navbar-custom {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1040;
  padding: 12px 24px;
  background: var(--navbar-bg);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: var(--heading-color);
}

.navbar-brand img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
}

.nav-links {
  display: flex;
  align-items: center;
}

.nav-links a {
  font-size: 0.95rem;
  margin-left: 24px;
  color: var(--muted-text);
  font-weight: 500;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--primary-color);
}

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
  margin-left: 24px;
}

.dropdown-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  color: var(--muted-text);
  font-weight: 500;
}

.dropdown-toggle:hover {
  color: var(--primary-color);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  min-width: 200px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  padding: 6px;
  z-index: 1050;
  opacity: 0;
  transition: all 0.2s ease;
  visibility: hidden;
}

.dropdown:hover .dropdown-menu {
  display: block;
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: 8px 12px;
  margin: 0 !important;
  border-radius: 6px;
  color: var(--text-color);
  font-size: 0.9rem;
  transition: background 0.2s ease;
  text-align: left;
}

.dropdown-menu a:hover {
  background: var(--surface-color);
  color: var(--primary-color);
}

body.dark-mode .navbar-brand img {
  filter: invert(1) hue-rotate(180deg);
}

/* ---------- HERO SECTION ---------- */
.hero-section {
  text-align: center;
  padding: 100px 20px 60px;
  max-width: 1000px;
  margin: 0 auto;
}

.hero-title {
  font-size: clamp(3rem, 6vw, 5rem);
  letter-spacing: -0.03em;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--heading-color) 30%, var(--primary-color));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: var(--muted-text);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---------- POSTS GRID ---------- */
.container-custom {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 40px;
  padding: 40px 0 80px;
}

.post-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.3s ease;
}

.post-card:hover {
  transform: translateY(-5px);
}

.post-image {
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
  aspect-ratio: 16/10;
  background: var(--surface-color);
  position: relative;
}

.post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.word-art {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  transition: transform 0.5s ease;
}

.word-art span {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 800;
  color: white;
  text-transform: uppercase;
  line-height: 1;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  word-break: break-word;
}

.post-card:hover .word-art {
  transform: scale(1.05);
}

/* Art Variants */
.art-1 { background: linear-gradient(135deg, #1E3A8A, #3B82F6); }
.art-2 { background: linear-gradient(135deg, #3B82F6, #60A5FA); }
.art-3 { background: linear-gradient(135deg, #06B6D4, #0EA5E9); }
.art-4 { background: linear-gradient(135deg, #4F46E5, #3B82F6); }
.art-5 { background: linear-gradient(135deg, #0EA5E9, #2563EB); }

.post-category {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  display: block;
}

.post-title {
  font-size: 1.5rem;
  margin-bottom: 12px;
  line-height: 1.3;
}

.post-title a {
  color: var(--heading-color);
}

.post-title a:hover {
  color: var(--primary-color);
}

.post-excerpt {
  color: var(--muted-text);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--muted-text);
}

.author-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ---------- MARQUEE ---------- */
.marquee-section {
  padding: 40px 0;
  overflow: hidden;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-color);
}

.marquee-content {
  display: flex;
  gap: 60px;
  animation: scroll 40s linear infinite;
  white-space: nowrap;
}

.marquee-tag {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--muted-text);
  opacity: 0.5;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

@keyframes scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ---------- FOOTER ---------- */
.footer {
  background: var(--surface-color);
  padding: 80px 0 40px;
  margin-top: 0;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted-text);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--primary-color);
}

/* ---------- MOBILE ---------- */
.navbar-toggler {
  display: none;
  background: none;
  border: none;
  color: var(--navbar-text);
  font-size: 1.5rem;
  cursor: pointer;
}

.nav-links-mobile {
  position: fixed;
  top: 0;
  right: -100%;
  width: 250px;
  height: 100%;
  background: var(--bg-color);
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  padding: 80px 20px;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 1045;
}

.nav-links-mobile.active {
  right: 0;
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .navbar-toggler { display: block; }
  .hero-title { font-size: 2.5rem; }
  .posts-grid { grid-template-columns: 1fr; }
}

/* Theme Toggle */
.theme-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  margin-left: 20px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: var(--primary-color);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

/* ---------- ADMIN / DASHBOARD STYLES ---------- */
.admin-header {
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-label {
    color: var(--muted-text);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--heading-color);
    line-height: 1;
}

.admin-section {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 30px;
}

.section-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    margin: 0;
    font-size: 1.1rem;
    color: var(--heading-color);
}

.table-responsive {
    overflow-x: auto;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
}

.table-custom th {
    text-align: left;
    padding: 16px 24px;
    color: var(--muted-text);
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.table-custom td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    vertical-align: middle;
}

.table-custom tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning-color); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger-color); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Form Styles */
.form-group {
    margin-bottom: 24px;
}

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

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea.form-control {
    min-height: 150px;
    resize: vertical;
}

.login-container {
    max-width: 400px;
    margin: 80px auto;
    padding: 40px;
    background: var(--surface-color);
    border-radius: 24px;
    text-align: center;
    border: 1px solid var(--border-color);
}
