/* ============================================
   AppA - PROFESSIONAL GREEN THEME
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:wght@700&display=swap');

/* ── CSS Variables ── */
:root {
  --g900: #064e3b;
  --g800: #065f46;
  --g700: #047857;
  --g600: #059669;
  --g500: #10b981;
  --g400: #34d399;
  --g300: #6ee7b7;
  --g100: #d1fae5;
  --g50:  #ecfdf5;

  --bg:        #f8fafc;
  --surface:   #ffffff;
  --surface2:  #f1f5f9;
  --border:    #e2e8f0;
  --text:      #0f172a;
  --text2:     #475569;
  --text3:     #94a3b8;

  --nav-bg:    var(--g900);
  --accent:    var(--g600);
  --radius:    12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Dark Mode ── */
body.dark-mode {
  --bg:      #0f172a;
  --surface: #1e293b;
  --surface2:#253047;
  --border:  #334155;
  --text:    #f1f5f9;
  --text2:   #94a3b8;
  --text3:   #64748b;
  --nav-bg:  #020d07;
  --accent:  var(--g500);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; word-break: break-word; }

html {
  font-size: 15px;
  position: relative;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 80px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface2); }
::-webkit-scrollbar-thumb { background: var(--g600); border-radius: 3px; }

/* ── Typography ── */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.3; color: var(--text); }
a { color: var(--g600); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--g700); }

/* ── NAVBAR ── */
.navbar {
  background: var(--nav-bg) !important;
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.navbar-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  color: #fff !important;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-brand .brand-dot {
  width: 8px; height: 8px;
  background: var(--g400);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.7; transform:scale(1.3); }
}

.navbar .nav-link {
  color: rgba(255,255,255,0.8) !important;
  font-weight: 500;
  padding: 0.45rem 0.85rem !important;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-size: 0.875rem;
}

.navbar .nav-link:hover {
  color: #fff !important;
  background: rgba(255,255,255,0.1);
}

.navbar .nav-link.active-link {
  color: var(--g300) !important;
  background: rgba(16,185,129,0.15);
}

.navbar-search .form-control {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: 0.875rem;
  height: 36px;
}

.navbar-search .form-control::placeholder { color: rgba(255,255,255,0.5); }
.navbar-search .form-control:focus {
  background: rgba(255,255,255,0.15);
  border-color: var(--g400);
  box-shadow: none;
  color: #fff;
}

.navbar-search .form-select {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-left: none;
  color: #fff;
  font-size: 0.8rem;
  height: 36px;
  width: 110px;
}

.navbar-search .btn-search {
  background: var(--g600);
  border: none;
  color: #fff;
  height: 36px;
  padding: 0 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.875rem;
  transition: var(--transition);
}

.navbar-search .btn-search:hover { background: var(--g500); }

.nav-badge {
  background: #ef4444;
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 4px;
  font-weight: 600;
}

.theme-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: var(--radius-sm);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
}

.theme-btn:hover { background: rgba(255,255,255,0.2); }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  overflow: hidden;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header-green {
  background: linear-gradient(135deg, var(--g800), var(--g600));
  color: white;
  padding: 1.25rem 1.5rem;
  border-bottom: none;
}

/* ── STAT CARDS ── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-color, var(--g600));
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── BUTTONS ── */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 1.1rem;
  transition: var(--transition);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--g600) !important;
  color: #fff !important;
  border-color: var(--g600) !important;
}
.btn-primary:hover {
  background: var(--g700) !important;
  border-color: var(--g700) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5,150,105,0.35);
}

.btn-success {
  background: var(--g600) !important;
  color: #fff !important;
  border-color: var(--g600) !important;
}
.btn-success:hover {
  background: var(--g700) !important;
  border-color: var(--g700) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5,150,105,0.35);
}

.btn-dark {
  background: var(--g900) !important;
  color: #fff !important;
  border-color: var(--g900) !important;
}
.btn-dark:hover {
  background: var(--g800) !important;
  border-color: var(--g800) !important;
  transform: translateY(-1px);
}

.btn-outline-green {
  background: transparent;
  border: 1.5px solid var(--g600);
  color: var(--g600);
}
.btn-outline-green:hover {
  background: var(--g600);
  color: #fff;
}

.btn-danger { border-radius: var(--radius-sm) !important; }
.btn-warning { border-radius: var(--radius-sm) !important; }

/* ── FORMS ── */
.form-control, .form-select {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  transition: var(--transition);
}

.form-control:focus, .form-select:focus {
  border-color: var(--g600);
  box-shadow: 0 0 0 3px rgba(5,150,105,0.15);
  background: var(--surface);
  color: var(--text);
}

.form-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text2);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dark-mode .form-control, .dark-mode .form-select {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
}

/* ── TABLES ── */
.table {
  color: var(--text);
}

.table thead th {
  background: var(--g900);
  color: rgba(255,255,255,0.9);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: none;
  padding: 1rem 1.2rem;
}

.table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.table tbody tr:hover {
  background: var(--surface2);
}

.table tbody td {
  padding: 0.85rem 1.2rem;
  vertical-align: middle;
  font-size: 0.875rem;
  border: none;
}

.dark-mode .table { color: var(--text); }
.dark-mode .table tbody tr:hover { background: var(--surface2); }

/* ── BADGES ── */
.badge {
  font-weight: 600;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 999px;
}

.badge-green   { background: var(--g100); color: var(--g800); }
.badge-success { background: var(--g100) !important; color: var(--g800) !important; }
.badge-danger  { background: #fee2e2 !important; color: #991b1b !important; }
.badge-warning { background: #fef3c7 !important; color: #92400e !important; }
.badge-gray    { background: var(--surface2); color: var(--text2); }

/* ── HERO SECTION ── */
.hero-section {
  background: linear-gradient(135deg, var(--g900) 0%, var(--g700) 50%, var(--g500) 100%);
  color: white;
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
  margin: -1.5rem -12px 2rem;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%; right: -10%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: -40%; left: -5%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
  border-radius: 50%;
}

/* ── BLOG CARDS ── */
.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--g300);
}

.blog-card .card-img-wrap {
  height: 200px;
  overflow: hidden;
  background: var(--g50);
  display: flex; align-items: center; justify-content: center;
}

.blog-card .card-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.blog-card:hover .card-img-wrap img { transform: scale(1.05); }

.blog-card .card-img-placeholder {
  color: var(--g400);
  font-size: 3rem;
}

.blog-card .card-content {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.blog-card .category-tag {
  background: var(--g50);
  color: var(--g700);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.blog-card .card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.blog-card .card-excerpt {
  font-size: 0.85rem;
  color: var(--text2);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 1rem;
}

.blog-card .card-footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.blog-card .author-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text2);
}

.author-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--g600), var(--g400));
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.7rem;
  flex-shrink: 0;
}

/* ── AUTH PAGES ── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--g900) 0%, var(--g700) 60%, var(--g500) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo h1 {
  font-family: 'Playfair Display', serif;
  color: var(--g600);
  font-size: 2rem;
}

/* ── ADMIN SIDEBAR ── */
.admin-wrapper {
  display: flex;
  gap: 0;
  min-height: calc(100vh - 65px);
}

.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--g900);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.5rem 0;
  position: sticky;
  top: 65px;
  height: calc(100vh - 65px);
  overflow-y: auto;
}

.admin-sidebar .sidebar-section {
  padding: 0 0.75rem;
  margin-bottom: 0.25rem;
}

.admin-sidebar .sidebar-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.75rem 0.75rem 0.35rem;
}

.admin-sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  color: rgba(255,255,255,0.7) !important;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
}

.admin-sidebar a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff !important;
}

.admin-sidebar a.active {
  background: rgba(16,185,129,0.2);
  color: var(--g300) !important;
}

.admin-sidebar a i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.admin-content {
  flex: 1;
  padding: 2rem;
  min-width: 0;
}

/* ── PAGINATION ── */
.pagination .page-link {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius-sm) !important;
  margin: 0 2px;
  font-size: 0.875rem;
  padding: 0.45rem 0.85rem;
  transition: var(--transition);
}

.pagination .page-link:hover {
  background: var(--g600);
  color: #fff;
  border-color: var(--g600);
}

.pagination .page-item.active .page-link {
  background: var(--g600);
  border-color: var(--g600);
  color: #fff;
  box-shadow: 0 3px 8px rgba(5,150,105,0.3);
}

.dark-mode .pagination .page-link {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text2);
}

/* ── ALERTS ── */
.alert {
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.875rem 1.1rem;
}

.alert-success { background: var(--g50); color: var(--g800); }
.alert-danger { background: #fef2f2; color: #b91c1c; }

/* ── DETAIL PAGE ── */
.blog-detail-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.blog-detail-cover {
  width: 100%; height: 380px;
  object-fit: cover;
}

.blog-detail-body { padding: 2rem; }

.blog-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text2);
}

.blog-meta-bar a { color: var(--g600); font-weight: 600; }

.blog-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ── COMMENT SECTION ── */
.comment-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.85rem;
  transition: var(--transition);
}

.comment-item:hover { border-color: var(--g300); }

.comment-author {
  font-weight: 700;
  color: var(--text);
  font-size: 0.875rem;
}

.comment-date {
  font-size: 0.75rem;
  color: var(--text3);
}

.comment-text {
  font-size: 0.9rem;
  color: var(--text2);
  margin: 0.5rem 0 0;
  line-height: 1.6;
}

/* ── PROFILE ── */
.profile-header {
  background: linear-gradient(135deg, var(--g900), var(--g700));
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  color: white;
  margin-bottom: 1.5rem;
}

.profile-avatar {
  width: 100px; height: 100px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.3);
  object-fit: cover;
  margin-bottom: 1rem;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
}

/* ── FOOTER ── */
footer {
  background: var(--g900);
  color: rgba(255,255,255,0.7);
  padding: 1.5rem 0;
  margin-top: 4rem;
  font-size: 0.85rem;
  text-align: center;
}

/* ── UTILITIES ── */
.text-green  { color: var(--g600) !important; }
.bg-green    { background: var(--g600) !important; }
.border-green{ border-color: var(--g600) !important; }

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.section-title::before {
  content: '';
  width: 4px; height: 20px;
  background: var(--g600);
  border-radius: 2px;
  display: inline-block;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text3);
}

.empty-state i { font-size: 3rem; margin-bottom: 1rem; color: var(--g300); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .admin-sidebar { display: none; }
  .admin-content { padding: 1rem; }
  .hero-section  { padding: 3rem 0 2rem; margin: -1rem -12px 1.5rem; }
  .stat-card .stat-value { font-size: 1.5rem; }
  .blog-detail-cover { height: 220px; }
  .navbar-search { display: none !important; }
  .auth-card { padding: 1.75rem; }
}

@media (max-width: 576px) {
  .blog-meta-bar { padding: 0.65rem 1rem; }
  .blog-detail-body { padding: 1.25rem; }
}

/* ── ANIMATIONS ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fadeInUp 0.4s ease both; }
