/* ============================================================
   ALKEBULAN GLOBAL ACADEMY — Admin Dashboard Styles
   ============================================================ */

:root {
  --green-deep:  #1a3d2b;
  --green-mid:   #2a5c40;
  --green-light: #3d7a57;
  --gold:        #c9922a;
  --gold-light:  #e5b455;
  --gold-pale:   #f5e6c8;
  --ivory:       #faf8f2;
  --white:       #ffffff;
  --charcoal:    #1e1e1e;
  --grey-dark:   #3a3a3a;
  --grey-mid:    #6b6b6b;
  --grey-light:  #e8e8e4;
  --border:      #ddd8cc;
  --bg:          #f4f5f7;

  --sidebar-w:   240px;
  --topbar-h:    64px;

  --font-serif:  'Cormorant Garamond', Georgia, serif;
  --font-sans:   'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius:      10px;
  --shadow-sm:   0 2px 8px rgba(0,0,0,.07);
  --shadow-md:   0 6px 20px rgba(0,0,0,.11);
  --shadow-lg:   0 16px 48px rgba(0,0,0,.18);
  --transition:  0.25s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--charcoal);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--green-deep);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.4rem 1.2rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.logo-emblem {
  font-size: 1.6rem;
  color: var(--gold-light);
  line-height: 1;
}
.logo-name {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.1;
}
.logo-sub {
  display: block;
  font-size: .7rem;
  color: rgba(255,255,255,.5);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem .8rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  color: rgba(255,255,255,.65);
  font-size: .88rem;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: var(--white);
}
.nav-item.active {
  background: rgba(201,146,42,.2);
  color: var(--gold-light);
  font-weight: 600;
}
.nav-item i { width: 18px; text-align: center; font-size: .95rem; }

.sidebar-footer {
  padding: .8rem;
  border-top: 1px solid rgba(255,255,255,.1);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin var(--transition);
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
  display: none;
  font-size: 1.1rem;
  color: var(--grey-dark);
  padding: .4rem;
}

.topbar-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green-deep);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .7rem;
}

.btn-export {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--green-deep);
  color: var(--white);
  padding: .5rem 1.1rem;
  border-radius: 2rem;
  font-size: .82rem;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-export:hover { background: var(--green-mid); transform: translateY(-1px); }

.btn-refresh {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  color: var(--grey-mid);
  font-size: .9rem;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.btn-refresh:hover { border-color: var(--green-mid); color: var(--green-mid); }
.btn-refresh.spinning i { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   VIEWS
   ============================================================ */
.view { display: none; padding: 1.5rem; }
.view.active { display: block; }

/* ============================================================
   SUMMARY CARDS
   ============================================================ */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition);
}
.summary-card:hover { box-shadow: var(--shadow-md); }

.card-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: var(--white);
  flex-shrink: 0;
}
.bg-green  { background: var(--green-mid); }
.bg-gold   { background: var(--gold); }
.bg-blue   { background: #3b82f6; }
.bg-purple { background: #8b5cf6; }

.card-body { display: flex; flex-direction: column; }
.card-num {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--green-deep);
  line-height: 1;
}
.card-label {
  font-size: .75rem;
  color: var(--grey-mid);
  margin-top: .25rem;
  font-weight: 500;
}

/* ============================================================
   FILTERS BAR
   ============================================================ */
.filters-bar {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-wrap i {
  position: absolute;
  left: .85rem; top: 50%;
  transform: translateY(-50%);
  color: var(--grey-mid);
  font-size: .85rem;
}
.search-wrap input {
  width: 100%;
  padding: .6rem .9rem .6rem 2.2rem;
  border: 1.5px solid var(--border);
  border-radius: 2rem;
  font-family: var(--font-sans);
  font-size: .88rem;
  color: var(--charcoal);
  outline: none;
  background: var(--ivory);
  transition: border-color var(--transition);
}
.search-wrap input:focus { border-color: var(--green-mid); background: var(--white); }

.filter-group {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}
.filter-group select {
  padding: .55rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: 2rem;
  font-family: var(--font-sans);
  font-size: .82rem;
  color: var(--charcoal);
  background: var(--ivory);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  padding-right: 1.8rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M5 6L0 0h10z' fill='%236b6b6b'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
}
.filter-group select:focus { border-color: var(--green-mid); }

.results-count {
  font-size: .8rem;
  color: var(--grey-mid);
  white-space: nowrap;
  font-weight: 500;
}

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: auto;
  box-shadow: var(--shadow-sm);
  position: relative;
  min-height: 200px;
}

.responses-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
  min-width: 1000px;
}

.responses-table thead {
  background: var(--green-deep);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
}
.responses-table th {
  padding: .9rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.responses-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}
.responses-table th.sortable:hover { background: var(--green-mid); }
.responses-table th.sort-asc i::before  { content: "\f0de"; }
.responses-table th.sort-desc i::before { content: "\f0dd"; }
.responses-table th i { margin-left: .4rem; opacity: .5; }

.responses-table tbody tr {
  border-bottom: 1px solid var(--grey-light);
  transition: background var(--transition);
}
.responses-table tbody tr:hover { background: var(--ivory); }
.responses-table tbody tr:last-child { border-bottom: none; }

.responses-table td {
  padding: .85rem 1rem;
  vertical-align: middle;
  color: var(--grey-dark);
  max-width: 180px;
}

.cell-name { font-weight: 600; color: var(--green-deep); }
.cell-email { color: var(--grey-mid); font-size: .8rem; }

.badge {
  display: inline-block;
  padding: .25rem .65rem;
  border-radius: 2rem;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-uae    { background: #e8f4ee; color: var(--green-mid); }
.badge-intl   { background: #eef2ff; color: #4f46e5; }
.badge-now    { background: #fef3c7; color: #92400e; }
.badge-future { background: var(--ivory); color: var(--grey-mid); }
.badge-yes    { background: #e8f4ee; color: var(--green-mid); }
.badge-maybe  { background: #fef9ee; color: var(--gold); }
.badge-no     { background: #f5f5f5; color: var(--grey-mid); }

.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}
.tag-sm {
  background: var(--gold-pale);
  color: var(--green-deep);
  padding: .18rem .5rem;
  border-radius: 2rem;
  font-size: .7rem;
  font-weight: 500;
}

.btn-view {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .85rem;
  background: var(--green-deep);
  color: var(--white);
  border-radius: 2rem;
  font-size: .75rem;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-view:hover { background: var(--green-mid); transform: translateY(-1px); }

.table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--grey-mid);
}
.table-empty i { font-size: 2.5rem; margin-bottom: 1rem; opacity: .4; }
.table-empty p { font-size: 1rem; font-weight: 600; color: var(--grey-dark); margin-bottom: .4rem; }
.table-empty span { font-size: .85rem; }

.table-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  padding: 3rem;
  color: var(--grey-mid);
  font-size: .9rem;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: 1.2rem 0 .5rem;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 600;
  color: var(--grey-dark);
  background: var(--white);
  cursor: pointer;
  transition: all var(--transition);
  padding: 0 .6rem;
}
.page-btn:hover:not(:disabled) { border-color: var(--green-mid); color: var(--green-mid); }
.page-btn.active { background: var(--green-deep); color: var(--white); border-color: var(--green-deep); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   STATS VIEW
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.stat-card h4 {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--green-deep);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.stat-card h4 i { color: var(--gold); }

.bar-chart { display: flex; flex-direction: column; gap: .7rem; }
.bar-row { display: flex; align-items: center; gap: .8rem; }
.bar-label {
  font-size: .78rem;
  color: var(--grey-dark);
  min-width: 130px;
  text-align: right;
  font-weight: 500;
}
.bar-track {
  flex: 1;
  height: 10px;
  background: var(--grey-light);
  border-radius: 5px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-mid), var(--green-light));
  border-radius: 5px;
  transition: width .6s ease;
}
.bar-val {
  font-size: .78rem;
  font-weight: 700;
  color: var(--green-deep);
  min-width: 24px;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.donut-legend { display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.legend-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .8rem;
  color: var(--grey-dark);
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.3rem 1.6rem;
  border-bottom: 1px solid var(--border);
  background: var(--green-deep);
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-header h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--white);
}
.modal-close {
  color: rgba(255,255,255,.7);
  font-size: 1rem;
  padding: .3rem .5rem;
  border-radius: 4px;
  transition: all var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,.1); color: var(--white); }

.modal-body { padding: 1.5rem 1.6rem; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.detail-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.detail-field.full { grid-column: 1 / -1; }
.detail-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gold);
}
.detail-value {
  font-size: .9rem;
  color: var(--grey-dark);
  background: var(--ivory);
  padding: .6rem .8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  line-height: 1.6;
  word-break: break-word;
}
.detail-value.empty { color: var(--grey-mid); font-style: italic; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .summary-cards { grid-template-columns: 1fr 1fr; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .search-wrap { min-width: unset; }
}

@media (max-width: 480px) {
  .summary-cards { grid-template-columns: 1fr; }
  .topbar-actions .btn-export span { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-field.full { grid-column: auto; }
}
