/* ============================================================
   Teams للمعلمين — GDVTE Branding Stylesheet
   General Directorate of Vocational and Technical Education
   ============================================================ */

/* ── Google Fonts already linked in PHP ── */
:root {
  --ink:        #0a0a0f;
  --paper:      #f5f0e8;
  --cream:      #ede8dc;
  --gold:       #b8860b;
  --gold-light: #d4a017;
  --gold-pale:  #f0e6c0;
  --red:        #8b1a1a;
  --red-light:  #a82020;
  --red-pale:   #fdf0f0;
  --muted:      #6b6055;
  --border:     #c8b89a;
  --white:      #ffffff;
  --shadow-sm:  rgba(10,10,15,0.08);
  --shadow-md:  rgba(10,10,15,0.14);
  --shadow-lg:  rgba(10,10,15,0.22);
  --teams-blue: #1565c0;
  --radius:     3px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Noto Kufi Arabic', 'Segoe UI', Arial, sans-serif;
  color: var(--ink);
  line-height: 1.6;
}

/* ── UTILITIES ── */
.teams-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--teams-blue);
  color: white;
  font-weight: 900;
  font-size: 1.1rem;
  border-radius: 6px;
  letter-spacing: -0.05em;
  flex-shrink: 0;
}

.teams-icon-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  background: var(--teams-blue);
  color: white;
  font-weight: 900;
  font-size: 0.75rem;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ── LOGIN PAGE ── */
.login-body {
  min-height: 100vh;
  background: var(--ink);
  background-image:
    radial-gradient(ellipse at 0% 0%, rgba(139,26,26,0.35) 0%, transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(21,101,192,0.25) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(184,134,11,0.08) 0%, transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.login-bg-pattern {
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 40px,
    rgba(255,255,255,0.015) 40px,
    rgba(255,255,255,0.015) 41px
  );
  pointer-events: none;
}

.login-wrapper {
  width: 100%;
  max-width: 460px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 8px 48px var(--shadow-lg), 0 2px 8px var(--shadow-sm);
  overflow: hidden;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-header {
  background: linear-gradient(135deg, var(--ink) 0%, #1a1a2e 100%);
  padding: 2rem 2rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 50%;
  border: 2px solid rgba(212,160,23,0.4);
  background: white;
  padding: 4px;
  flex-shrink: 0;
}

.login-brand { flex: 1; }

.brand-ar {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1.4;
}

.brand-en {
  font-size: 0.62rem;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
  line-height: 1.3;
}

.brand-product {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
}

.login-divider {
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--teams-blue));
}

.login-title {
  padding: 1.5rem 2rem 0.3rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.login-desc {
  padding: 0 2rem 1rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.login-form {
  padding: 0 2rem 1.5rem;
}

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

.field-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.field-wrap {
  position: relative;
}

.field-input {
  width: 100%;
  padding: 0.7rem 2.5rem 0.7rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  outline: none;
  direction: ltr;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field-input:focus {
  border-color: var(--gold);
  background: var(--white);
  box-shadow: 0 0 0 3px var(--gold-pale);
}

.toggle-pw {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0.2rem;
  display: flex;
}
.toggle-pw:hover { color: var(--ink); }

.btn-login {
  width: 100%;
  padding: 0.8rem;
  background: var(--red);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(139,26,26,0.3);
}
.btn-login:hover {
  background: var(--red-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(139,26,26,0.35);
}
.btn-login:active { transform: translateY(0); }

.login-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 1rem 2rem;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--paper);
  border-top: 1px solid var(--cream);
}

.alert {
  margin: 0 2rem 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.83rem;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}

.alert-error {
  background: var(--red-pale);
  border: 1px solid #e8c0c0;
  color: var(--red);
}

.alert-icon { flex-shrink: 0; margin-top: 1px; }

/* ── DASHBOARD ── */
.dash-body {
  background: var(--paper);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TOP NAV */
.topnav {
  background: var(--ink);
  border-bottom: 2px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topnav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.nav-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 50%;
  border: 1px solid rgba(212,160,23,0.4);
  background: white;
  padding: 2px;
  flex-shrink: 0;
}

.nav-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.nav-product {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
}

.nav-org {
  font-size: 0.62rem;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.school-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(212,160,23,0.12);
  border: 1px solid rgba(212,160,23,0.25);
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  color: var(--gold-light);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(139,26,26,0.2);
  border: 1px solid rgba(139,26,26,0.4);
  color: #e88;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s;
  cursor: pointer;
}
.btn-logout:hover { background: rgba(139,26,26,0.4); }

/* MAIN */
.dash-main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

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

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.header-actions {
  display: flex;
  gap: 0.6rem;
  flex-shrink: 0;
}

.btn-print {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--white);
  border: 1.5px solid var(--border);
  color: var(--muted);
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-print:hover { border-color: var(--gold); color: var(--ink); }

.btn-download {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--red);
  color: white;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 2px 6px rgba(139,26,26,0.25);
}
.btn-download:hover { background: var(--red-light); transform: translateY(-1px); }

/* STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 1px 4px var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2.5px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.stat-primary::after {
  background: linear-gradient(90deg, var(--red), var(--gold));
}

.stat-icon { font-size: 1.5rem; flex-shrink: 0; }

.stat-number {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* TABLE SECTION */
.table-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 12px var(--shadow-sm);
}

.table-toolbar {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--cream);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--paper);
  flex-wrap: wrap;
}

.search-wrap {
  flex: 1;
  min-width: 180px;
  position: relative;
}

.search-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.55rem 2.5rem 0.55rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  background: var(--white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-pale);
}

.table-count {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 600px;
}

.data-table thead th {
  background: var(--ink);
  color: var(--gold-light);
  padding: 0.75rem 1rem;
  text-align: right;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table thead th.col-ltr,
.data-table tbody td.col-ltr {
  direction: ltr;
  text-align: left;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
}

.data-table thead th.col-num,
.data-table tbody td.col-num {
  text-align: center;
  width: 48px;
  color: #aaa;
  font-size: 0.78rem;
}

.data-table tbody td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--cream);
  color: var(--ink);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td {
  background: var(--paper);
}

.no-results {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* FOOTER */
.dash-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 1.25rem 0;
  margin-top: 1.5rem;
  border-top: 1px solid var(--cream);
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── PRINT STYLES ── */
@media print {
  .topnav, .header-actions, .stats-grid, .table-toolbar,
  .dash-footer, .btn-download, .btn-print { display: none !important; }
  .dash-body { background: white; }
  .dash-main { padding: 0; max-width: none; }
  .table-section { border: none; box-shadow: none; }
  .data-table thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .page-header {
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #0a0a0f;
    margin-bottom: 1rem;
  }
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .login-header { flex-direction: column; text-align: center; gap: 1rem; }
  .nav-org { display: none; }
  .page-header { flex-direction: column; }
  .header-actions { width: 100%; }
  .btn-print, .btn-download { flex: 1; justify-content: center; }
  .data-table thead th:nth-child(4),
  .data-table tbody td:nth-child(4) { display: none; }
}

/* ── USERNAME / PASSWORD FIELD ADDITIONS ── */
.field-ltr {
  direction: ltr;
  text-align: left;
  font-family: 'Courier New', monospace;
  font-size: 0.92rem;
  padding-right: 2.5rem;
  padding-left: 0.9rem;
}

.field-prefix-icon {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

/* Credentials info box shown after login */
.creds-box {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  display: flex;
  gap: 2rem;
  align-items: center;
  font-size: 0.8rem;
  flex-wrap: wrap;
}

.cred-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cred-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cred-value {
  font-family: 'Courier New', monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  direction: ltr;
  text-align: left;
}

.cred-value.pw {
  color: var(--red);
  letter-spacing: 0.05em;
}

/* ── PASSWORD TOGGLE IN TABLE TOOLBAR ── */
.pw-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.pw-toggle-label input[type="checkbox"] {
  accent-color: var(--red);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ── ADMIN BADGE ── */
.admin-badge {
  display: inline-flex;
  align-items: center;
  background: var(--gold);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.08em;
  vertical-align: middle;
}

/* ── SCHOOL FILTER DROPDOWN ── */
.school-filter-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.82rem;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  max-width: 240px;
  outline: none;
  transition: border-color 0.15s;
}
.school-filter-select:focus { border-color: var(--gold); }
