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

:root {
  --bg-dark: #070709;
  --bg-card: #0f0f14;
  --bg-card-hover: #16161e;
  --bg-input: #15151c;
  --border-color: rgba(255, 31, 60, 0.15);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --accent-red: #ff1f3c;
  --accent-red-hover: #e01430;
  --accent-red-glow: rgba(255, 31, 60, 0.25);
  --accent-gradient: linear-gradient(135deg, #ff1f3c 0%, #a80015 100%);
  --text-primary: #f5f5f7;
  --text-secondary: #9d9da8;
  --text-muted: #6b6b77;
  --font-main: 'Outfit', 'Inter', sans-serif;
  --sidebar-width: 260px;
  --header-height: 70px;
  --transition: all 0.25s ease;
  --radius: 12px;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-width);
  background-color: #0b0b0f;
  border-right: 1px solid var(--border-color);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-brand {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
  height: 38px;
  width: auto;
}

.sidebar-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.sidebar-title span {
  color: var(--accent-red);
}

.sidebar-menu {
  list-style: none;
  padding: 1.25rem 0.85rem;
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.menu-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.35rem;
  font-weight: 700;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
}

.sidebar-link ion-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.sidebar-link:hover {
  background-color: rgba(255, 31, 60, 0.08);
  color: #ffffff;
}

.sidebar-link.active {
  background: var(--accent-gradient);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 16px var(--accent-red-glow);
}

.badge-count {
  margin-left: auto;
  background-color: var(--accent-red);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #222, #444);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.user-role {
  font-size: 0.75rem;
  color: var(--accent-red);
}

/* Main Content Area */
.admin-main {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-dark);
}

/* Topbar */
.admin-topbar {
  height: var(--header-height);
  background-color: rgba(11, 11, 15, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

.page-headline {
  font-size: 1.25rem;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-visit-site {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
  color: #fff;
  transition: var(--transition);
}

.btn-visit-site:hover {
  background-color: rgba(255, 31, 60, 0.1);
  border-color: var(--accent-red);
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  transition: var(--transition);
}

.btn-logout:hover {
  color: var(--accent-red);
}

/* Page Body Container */
.admin-container {
  padding: 2rem;
  flex-grow: 1;
}

/* Flash Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.alert-success {
  background-color: rgba(46, 213, 115, 0.12);
  border: 1px solid rgba(46, 213, 115, 0.3);
  color: #2ed573;
}

.alert-danger {
  background-color: rgba(255, 31, 60, 0.12);
  border: 1px solid rgba(255, 31, 60, 0.3);
  color: #ff4757;
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: var(--transition);
}

.stat-box:hover {
  border-color: var(--border-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.stat-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(255, 31, 60, 0.1);
  color: var(--accent-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* Content Cards */
.admin-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-red-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background-color: rgba(255, 31, 60, 0.15);
  color: #ff4757;
  border: 1px solid rgba(255, 31, 60, 0.3);
}

.btn-danger:hover {
  background-color: #ff1f3c;
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th {
  padding: 0.9rem 1rem;
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  font-size: 0.9rem;
}

.admin-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

.thumb-preview {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
}

/* Status Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-upcoming {
  background-color: rgba(0, 184, 148, 0.15);
  color: #00b894;
  border: 1px solid rgba(0, 184, 148, 0.3);
}

.badge-completed {
  background-color: rgba(113, 113, 122, 0.2);
  color: var(--text-muted);
}

.badge-published {
  background-color: rgba(0, 184, 148, 0.15);
  color: #00b894;
  border: 1px solid rgba(0, 184, 148, 0.3);
}

.badge-draft {
  background-color: rgba(253, 203, 110, 0.15);
  color: #fdcb6e;
  border: 1px solid rgba(253, 203, 110, 0.3);
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px rgba(255, 31, 60, 0.15);
}

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

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Checkbox and Radios */
.form-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-red);
  cursor: pointer;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop.show {
  display: flex;
}

.modal-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  position: relative;
}

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

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Responsive */
@media (max-width: 992px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

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

  .admin-main {
    margin-left: 0;
    width: 100%;
  }

  .mobile-toggle {
    display: block;
  }
}
