/* ============================================================
 * Al-Azhar Results Portal — Organic Design System
 * Inspired by AUC 62 ULT APP (Warm Cream, Terracotta & Sage)
 * ============================================================ */

:root {
  /* Organic Color Tokens */
  --brand: #c67139;
  --brand-ink: #8c491a;
  --brand-soft: #fff2eb;
  --brand-fill: #c67139;
  --brand-fill-hover: #b2622d;
  
  --accent: #7a8a5e;
  --accent-ink: #56633f;
  --accent-soft: #f0fae1;
  
  --ink: #201e1d;
  --ink-soft: #645c50;
  --ink-faint: #82796a;
  
  --surface: #ebddc5;
  --surface-2: #eee7db;
  --surface-card: #f3e8d7;
  --canvas: #f5ead8;
  
  --line: color-mix(in srgb, #201e1d 14%, transparent);
  --line-strong: color-mix(in srgb, #201e1d 25%, transparent);
  
  --danger: #a13a2f;
  --danger-soft: #fbeae7;
  
  --focus-ring: #c67139;
  
  /* Border Radii */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  
  /* Soft Organic Shadows */
  --shadow-sm: 0 2px 6px color-mix(in srgb, #2e2b25 10%, transparent);
  --shadow-md: 0 6px 18px color-mix(in srgb, #2e2b25 14%, transparent);
  --shadow-lg: 0 16px 36px color-mix(in srgb, #2e2b25 18%, transparent);
  
  --font-main: 'Cairo', sans-serif;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

::selection {
  background-color: var(--brand-soft);
  color: var(--brand-ink);
}

body {
  font-family: var(--font-main);
  background-color: var(--canvas);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
}

.page-wash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 900px 500px at 10% -10%, color-mix(in srgb, var(--brand) 12%, transparent), transparent),
    radial-gradient(ellipse 800px 450px at 105% 15%, color-mix(in srgb, var(--accent) 14%, transparent), transparent);
  background-repeat: no-repeat;
}

.container {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

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

.kicker {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand-ink);
  display: inline-block;
  margin-bottom: 0.5rem;
}

.main-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.main-title span {
  color: var(--brand);
}

.subtitle {
  color: var(--ink-soft);
  font-size: 1.1rem;
  margin-top: 0.6rem;
  font-weight: 500;
}

.organic-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.tabs {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 0.35rem;
  margin-bottom: 2rem;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn.active {
  background: var(--brand);
  color: var(--canvas);
  box-shadow: var(--shadow-sm);
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.name-inputs-container {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.filter-row {
  display: flex;
  gap: 1rem;
}

.flex-1 { flex: 1; }

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-weight: 700;
  color: var(--ink);
  font-size: 1rem;
}

.input-group input,
.filter-select {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: inherit;
  font-size: 1.05rem;
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.filter-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23645c50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: left 1rem center;
  background-size: 1.2em;
}

.input-group input:focus,
.filter-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
  background: var(--canvas);
}

.input-group input::placeholder {
  color: var(--ink-faint);
}

.turnstile-container {
    display: flex;
    justify-content: center;
    margin: 1.25rem 0;
}

/* AdBlocker Friendly Notice Banner */
.adblock-notice {
    background-color: rgba(198, 113, 57, 0.12);
    border: 1px solid var(--color-terracotta);
    color: var(--color-terracotta-dark);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    margin: 1rem 0;
    line-height: 1.5;
}

/* 10-Result Limit Guidance Notice */
.name-results-limit-notice {
    background-color: rgba(122, 138, 94, 0.14);
    border: 1px dashed var(--color-sage);
    color: #4a5933;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-top: 0.85rem;
    text-align: center;
}

.submit-btn {
  background: var(--brand);
  color: var(--canvas);
  border: none;
  padding: 1.15rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.submit-btn:hover:not(:disabled) {
  background: var(--brand-fill-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.submit-btn:disabled {
  background: var(--neutral-300);
  color: var(--ink-faint);
  cursor: not-allowed;
  box-shadow: none;
}

.loader {
  width: 24px;
  height: 24px;
  border: 3px solid color-mix(in srgb, var(--canvas) 30%, transparent);
  border-radius: 50%;
  border-top-color: var(--canvas);
  animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-message {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  text-align: center;
  font-weight: 700;
}

.hidden { display: none !important; }

/* Name Search Preview List */
.name-results-header {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--brand-ink);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.name-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.name-item {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
}

.name-item:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  transform: translateX(-4px);
  box-shadow: var(--shadow-sm);
}

.name-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.name-item-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}

.name-item-sub {
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.name-item-action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--brand-ink);
}

/* Results Container */
.results-container {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.result-card {
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  background: var(--surface-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}

.student-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
}

.back-link {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand-ink);
  cursor: pointer;
  transition: var(--transition);
}

.back-link:hover {
  color: var(--brand);
  text-decoration: underline;
}

.status-badge {
  padding: 0.45rem 1.3rem;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.95rem;
}

.badge-success { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.badge-warning { background: var(--brand-soft); color: var(--brand-ink); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); }
.badge-error { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }

/* Scores Hero Grid */
.scores-hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.score-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
}

.score-label { color: var(--ink-soft); font-size: 0.88rem; font-weight: 700; }
.score-value { font-size: 1.75rem; font-weight: 800; color: var(--ink); }

.brand-highlight {
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent);
}

.brand-highlight .score-value { color: var(--brand-ink); }

/* Info Details Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.info-item {
  background: var(--surface);
  padding: 0.95rem 1.2rem;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line);
}

.info-item .label { color: var(--ink-soft); font-size: 0.95rem; font-weight: 600; }
.info-item .value { font-weight: 800; color: var(--ink); font-size: 1.05rem; }

/* Rankings Section */
.ranks-section {
  padding-top: 1.5rem;
  border-top: 2px dashed var(--line);
}

.ranks-title {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  color: var(--brand-ink);
}

.ranks-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
}

.rank-card {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 1.35rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.rank-label { color: var(--ink-soft); font-size: 0.95rem; font-weight: 700; }
.rank-value { font-size: 2rem; font-weight: 800; color: var(--brand-ink); }

.ad-placeholder {
  text-align: center;
  padding: 1.75rem;
  color: var(--ink-soft);
  font-weight: 600;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.telegram-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  text-decoration: none;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 800;
  font-size: 1.1rem;
  padding: 1.2rem;
  border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
  transition: var(--transition);
}

.telegram-link:hover {
  background: var(--brand);
  color: var(--canvas);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.footer {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--ink-soft);
  font-weight: 600;
  margin-top: auto;
  border-top: 1px solid var(--line);
}

.fade-in-up {
  animation: fadeInUp 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

@media (max-width: 600px) {
  .filter-row { flex-direction: column; }
  .scores-hero-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .ranks-grid { grid-template-columns: 1fr; }
}
