:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --dark: #0f172a;
  --light: #f8fafc;
  --glass: rgba(255, 255, 255, 0.85);
  --border: #e2e8f0;
  --sidebar-bg: #ebebed;
  --sidebar-border: #d2d2d7;
  --text-main: #202223;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Outfit', sans-serif;
  background-color: #f6f6f7;
  color: var(--dark);
  line-height: 1.6;
}

/* ADMIN WRAPPER LAYOUT */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* FIXED SIDEBAR */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 1rem 0;
  position: fixed;
  height: 100vh;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.sidebar-header {
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  margin-bottom: 1rem;
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo i {
  font-size: 1.4rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  margin: 1rem 1rem 0.25rem 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}

.sidebar-link i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  color: #616161;
}

.sidebar-link:hover {
  background: #e1e1e3;
  color: #000;
}

.sidebar-link.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.sidebar-link.active i {
  color: var(--primary);
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ef4444;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: opacity 0.2s;
}

.btn-logout:hover {
  opacity: 0.8;
}

/* MAIN CONTENT AREA WITH FIXED SIDEBAR OFFSET */
.admin-content {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* STICKY HEADER */
header {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.header-title h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--dark);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.meta-item {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.meta-item i {
  margin-right: 4px;
}

/* CONTENT CONTAINER */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
  flex: 1;
}

/* PAGE HEADER ELEMENT */
.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--dark);
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* TAB CONTENT CONTAINER */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

/* STAT CARDS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.stat-card .value {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  line-height: 1;
}

.stat-card .label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.stat-card .label i {
  font-size: 0.85rem;
}

@media (max-width: 992px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* FORMS & FILTERS */
.card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

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

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

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

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

input, select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--dark);
  background-color: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

/* WARNING / ALERT NOTIFICATIONS */
.warning-box {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: none;
  align-items: flex-start;
  gap: 12px;
}

.warning-box i {
  color: #d97706;
  font-size: 1.2rem;
  margin-top: 2px;
}

.warning-box-content h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #92400e;
}

.warning-box-content p {
  font-size: 0.8rem;
  color: #b45309;
  margin-top: 2px;
}

/* BUTTONS */
.btn {
  padding: 0.7rem 1.25rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-danger-light {
  background: #fef2f2;
  color: #ef4444;
  border: 1px solid #fee2e2;
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  border-radius: 6px;
}

.btn-danger-light:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* TABLES DESIGN */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: #ffffff;
  text-align: left;
}

th {
  background-color: #f8fafc;
  padding: 0.85rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  letter-spacing: 0.05em;
}

td {
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}

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

tr:hover td {
  background-color: #f8fafc;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-country {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge-tr {
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #fee2e2;
}

/* SEARCH & TABLE CONTROLS */
.table-header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.search-input-wrapper {
  position: relative;
  width: 300px;
}

.search-input-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-input-wrapper input {
  padding-left: 2.25rem;
}

/* COUNTRY STATISTICS STYLING */
.country-stat-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.country-stat-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.country-stat-bar-bg {
  background-color: #f1f5f9;
  border-radius: 4px;
  height: 8px;
  width: 100%;
  overflow: hidden;
}

.country-stat-bar-fill {
  background-color: var(--primary);
  height: 100%;
  border-radius: 4px;
  width: 0;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* FIXED FOOTER */
footer {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: auto;
  position: sticky;
  bottom: 0;
  z-index: 100;
}

/* LOGIN LAYOUT */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: #f0f2f5;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.login-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--dark);
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: none;
}

.alert-danger {
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #fee2e2;
}

.alert-success {
  background-color: #f0fdf4;
  color: #16a34a;
  border: 1px solid #dcfce7;
}

/* ANIMATIONS */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVENESS */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .admin-content {
    margin-left: 0;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .table-header-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .search-input-wrapper {
    width: 100%;
  }
}
