* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1f855a;
  --primary-dark: #166a47;
  --secondary: #ecf7f2;
  --text: #2f3e4f;
  --text-light: #6a788a;
  --border: #dde3ea;
  --bg: #f3f6f8;
  --surface: #ffffff;
  --white: #ffffff;
  --error: #d32f2f;
  --success: #2e7d32;
  --warning: #f59e0b;
  --shadow: rgba(17, 29, 49, 0.08);
  --shadow-strong: rgba(17, 29, 49, 0.16);
}

* {
  transition: all 0.2s ease-in-out;
}

body {
  font-family: "Inter", "Open Sans", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background-color: var(--bg);
  color: var(--text);
}

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, rgba(27, 109, 74, 0.8) 0%, rgba(13, 61, 38, 0.8) 100%), url("../public/dlsjbc-bg.jpg") center / cover no-repeat;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-box {
  background: var(--white);
  border-radius: 8px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo {
  width: 80px;
  height: auto;
  margin: 0 auto 15px;
  display: block;
}

.login-header h1 {
  font-size: 28px;
  color: var(--text);
  margin-bottom: 5px;
}

.login-header p {
  color: var(--text-light);
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

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

.form-group input {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 109, 74, 0.1);
}

.btn-login {
  padding: 12px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-login:hover {
  background: var(--primary-dark);
}

.login-footer {
  text-align: center;
  margin-top: 20px;
}

.login-footer a {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* Alerts */
.alert {
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
  border-left: 4px solid;
}

.alert-error {
  background: #ffebee;
  color: #c62828;
  border-left-color: #d32f2f;
}

.alert-success {
  background: #e8f5e9;
  color: #2e7d32;
  border-left-color: #388e3c;
}

.alert-warning {
  background: #fff3e0;
  color: #e65100;
  border-left-color: #fbc02d;
}

/* Admin Layout */
.admin-container {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, rgba(31,133,90,0.98) 0%, rgba(22,106,71,0.98) 100%);
  color: var(--white);
  padding: 28px 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.12);
  transition: transform 0.25s ease, background-color 0.25s ease;
}

/* Hide default scrollbar on desktop while preserving scroll */
.sidebar::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}
.sidebar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: transparent;
}

.sidebar-header {
  padding: 0 24px 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.sidebar-header p {
  font-size: 0.82rem;
  opacity: 0.85;
  color: rgba(255,255,255,0.9);
}

.sidebar-header p {
  font-size: 12px;
  opacity: 0.8;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  border-left: 3px solid transparent;
  border-radius: 0 12px 12px 0;
  transition: all 0.3s ease;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.11);
  color: var(--white);
  transform: translateX(1px);
}

.menu-item.active {
  background: rgba(255, 255, 255, 0.16);
  color: var(--white);
  border-left-color: #ffffff;
}

.menu-item .icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  color: #ffffff;
  background: rgba(255,255,255,0.16);
  border-radius: 6px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.12);
}

.sidebar-menu a:nth-child(1) .icon::before { content: "\25A0"; font-size: 14px; }
.sidebar-menu a:nth-child(2) .icon::before { content: "\25B6"; font-size: 14px; }
.sidebar-menu a:nth-child(3) .icon::before { content: "\25A3"; font-size: 14px; }
.sidebar-menu a:nth-child(4) .icon::before { content: "\2709"; font-size: 14px; }
.sidebar-footer a:nth-child(1) .icon::before { content: "\21A9"; font-size: 14px; }
.sidebar-footer a:nth-child(2) .icon::before { content: "\23FB"; font-size: 14px; }

.menu-item span:last-child {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.sidebar-footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 16px 18px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.menu-item.logout {
  color: #ffdede;
}

.menu-item.logout:hover {
  background: rgba(255, 120, 120, 0.15);
  border-left-color: #ffdede;
}

.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 30px 34px;
  overflow-y: auto;
  transition: margin 0.3s ease, padding 0.3s ease;
  width: calc(100% - 260px);
  background: var(--bg);
}

.main-content .page-header,
.stats-grid,
.dashboard-grid,
.card,
.stat-card {
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.main-content .page-header:hover,
.stats-grid:hover,
.dashboard-grid:hover,
.card:hover,
.stat-card:hover {
  transform: translateY(-1px);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  z-index: 1050;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  padding: 0 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  z-index: 1075;
}

.hamburger-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 8px;
  background: var(--border);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.admin-container.sidebar-open .sidebar {
  transform: translateX(0);
}

.admin-container.sidebar-open .sidebar-overlay {
  display: block;
  opacity: 1;
  visibility: visible;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #253444;
}

.page-header p {
  color: var(--text-light);
  font-size: 0.94rem;
  font-weight: 500;
}

.page-header .page-subtitle {
  color: var(--text-light);
  display: block;
  margin-top: 2px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: #d0d0d0;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 8px 24px var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 46px;
  min-width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(31,133,90,0.16);
  color: var(--primary);
  border-radius: 50%;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}

.stat-content h3 {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-bottom: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: #1f855a;
  margin-bottom: 6px;
}

.stat-content small {
  color: var(--text-light);
  font-size: 0.82rem;
  font-weight: 500;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 20px var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.card h2 {
  font-size: 1.1rem;
  margin: 0;
  padding: 20px;
  font-weight: 700;
  color: #203240;
  border-bottom: 1px solid var(--border);
}

.card-header {
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.search-input,
.filter-select {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.search-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Lists */
.recent-list,
.articles-list,
.admissions-list,
.messages-list {
  padding: 16px;
}

.recent-item,
.article-item,
.admission-item,
.message-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 13px 10px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.recent-item:last-child,
.article-item:last-child,
.admission-item:last-child,
.message-item:last-child {
  border-bottom: none;
}

.item-info h4,
.article-info h3,
.admission-info h3,
.message-info h3 {
  font-size: 1rem;
  margin-bottom: 3px;
  color: #203240;
  font-weight: 700;
}

.item-info p,
.article-info p,
.admission-info p,
.message-info p {
  font-size: 0.86rem;
  color: var(--text-light);
  margin: 2px 0;
}

.item-info small,
.article-meta small {
  font-size: 0.8rem;
  color: #7f8a99;
}

.item-info small,
.article-meta small {
  font-size: 12px;
  color: #999;
}

.article-meta {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.category-badge {
  background: var(--secondary);
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-approved {
  background: #d4edda;
  color: #155724;
}

.status-rejected {
  background: #f8d7da;
  color: #721c24;
}

.status-unread {
  background: #e3f2fd;
  color: #1565c0;
}

.status-read {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-replied {
  background: #f3e5f5;
  color: #6a1b9a;
}

/* Actions */
.article-actions,
.item-actions,
.admission-actions,
.message-actions {
  display: flex;
  gap: 10px;
}

.action-link,
.action-btn {
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.78rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  font-weight: 600;
}

.action-link {
  background: #eef7f1;
  color: #1f855a;
  border-color: #d7ece4;
}

.action-link:hover {
  background: #ddefe4;
}

.action-btn.edit {
  background: #eaf4ff;
  color: #0f6db7;
  border-color: #c5def0;
}

.action-btn.edit:hover {
  background: #d3e6fc;
}

.action-btn.delete {
  background: #fff5f5;
  color: #c62828;
  border-color: #f3c2c2;
}

.action-btn.delete:hover {
  background: #ffeaea;
}

.action-btn.edit:hover {
  background: #90caf9;
}

.action-btn.delete {
  background: #ffcdd2;
  color: #d32f2f;
}

.action-btn.delete:hover {
  background: #f8a5a5;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: var(--white);
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
  font-size: 20px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-light);
}

.close-btn:hover {
  color: var(--text);
}

/* Forms */
.article-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
}

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

.form-group input,
.form-group textarea,
.form-group select {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 109, 74, 0.1);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 10px;
}

.status-form {
  width: 100%;
}

.status-form select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .admin-container {
    overflow-x: hidden;
  }

  .mobile-header {
    display: flex;
  }

  .sidebar {
    width: 240px;
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1100;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.12);
    margin-top: 0;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 70px 16px 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .stats-grid {
    grid-template-columns: repeat(1, 1fr);
    gap: 16px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .card {
    margin-bottom: 16px;
  }

  .sidebar-overlay {
    display: block;
    opacity: 0;
    visibility: hidden;
  }

  .admin-container.sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 600px) {
  .sidebar {
    width: 240px;
    position: fixed;
    height: 100vh;
    max-height: 100vh;
    transform: translateX(-100%);
    z-index: 1100;
  }

  .main-content {
    padding: 70px 12px 12px;
  }

  .stat-card {
    gap: 12px;
  }

  .item-info h4,
  .article-info h3,
  .admission-info h3,
  .message-info h3 {
    font-size: 15px;
  }

  .item-info p,
  .article-info p,
  .admission-info p,
  .message-info p {
    font-size: 12px;
  }

  .recent-item,
  .article-item,
  .admission-item,
  .message-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .article-actions,
  .item-actions,
  .admission-actions,
  .message-actions {
    width: 100%;
    margin-top: 10px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .action-btn,
  .action-link,
  .btn {
    min-height: 40px;
    font-size: 14px;
    padding: 10px 14px;
  }

  .card,
  .stat-card,
  .modal-content {
    padding: 14px;
  }
}
