/* ============================================================
   UI Final Polish - Step 24
   سامانه آموزش رجال و درایه حیات طیبه
   ============================================================ */

:root {
    --ht-primary: #064e3b;
    --ht-primary-2: #14532d;
    --ht-dark: #0f172a;
    --ht-gold: #d6a84f;
    --ht-gold-soft: #fff7df;
    --ht-bg: #f8fafc;
    --ht-card: #ffffff;
    --ht-border: #e2e8f0;
    --ht-muted: #64748b;
    --ht-text: #0f172a;
    --ht-success: #16a34a;
    --ht-danger: #dc2626;
    --ht-warning: #d97706;
    --ht-radius-xl: 28px;
    --ht-radius-lg: 20px;
    --ht-radius-md: 14px;
    --ht-shadow-soft: 0 18px 50px rgba(15, 23, 42, .07);
    --ht-shadow-hover: 0 24px 70px rgba(15, 23, 42, .12);
}

html {
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at top right, rgba(214,168,79,.13), transparent 30%),
        radial-gradient(circle at top left, rgba(6,78,59,.10), transparent 26%),
        #f8fafc;
    color: var(--ht-text);
}

/* Container polish */
.container {
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 18px;
    padding-right: 18px;
}

/* Header polish */
.ht-header,
.site-header,
header {
    backdrop-filter: blur(14px);
}

.ht-header {
    background: rgba(255,255,255,.92) !important;
    border-bottom: 1px solid rgba(226,232,240,.9);
    box-shadow: 0 8px 30px rgba(15,23,42,.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.ht-brand,
.site-brand,
.logo {
    font-weight: 900;
    letter-spacing: -.3px;
}

/* Search box guarantee visibility */
.ht-search-form {
    display: flex !important;
    align-items: center;
    gap: 7px;
    background: #fff;
    border: 1px solid #dbe4ee;
    border-radius: 999px;
    padding: 5px;
    box-shadow: 0 8px 24px rgba(15,23,42,.06);
    min-width: 270px;
    max-width: 380px;
}

.ht-search-input {
    display: block !important;
    width: 100% !important;
    min-width: 170px;
    border: 0 !important;
    background: transparent !important;
    padding: 9px 12px !important;
    font-family: inherit;
    color: #0f172a;
}

.ht-search-input:focus {
    outline: none !important;
    box-shadow: none !important;
}

.ht-search-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border: 0;
    background: linear-gradient(135deg, #d6a84f, #f2cf7a) !important;
    color: #111827 !important;
    border-radius: 999px !important;
    padding: 9px 15px !important;
    font-family: inherit;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
}

/* Hero unified */
.ht-hero,
.hero,
.home-hero,
.learning-hero,
.lessons-hero,
.sanad-hero,
.narrators-hero,
.quizzes-hero,
.quality-hero {
    background:
        linear-gradient(135deg, rgba(6,78,59,.98), rgba(15,23,42,.98)),
        radial-gradient(circle at top left, rgba(214,168,79,.25), transparent 34%);
    color: #fff;
    border-radius: var(--ht-radius-xl);
    padding: 42px;
    margin: 28px 0;
    border: 1px solid rgba(255,255,255,.12);
    border-bottom: 7px solid var(--ht-gold);
    box-shadow: var(--ht-shadow-soft);
    position: relative;
    overflow: hidden;
}

.ht-hero::after,
.hero::after,
.home-hero::after,
.learning-hero::after,
.lessons-hero::after,
.sanad-hero::after,
.narrators-hero::after,
.quizzes-hero::after,
.quality-hero::after {
    content: "";
    position: absolute;
    inset: auto -80px -110px auto;
    width: 260px;
    height: 260px;
    background: rgba(214,168,79,.16);
    border-radius: 50%;
}

.ht-hero h1,
.hero h1,
.home-hero h1,
.learning-hero h1,
.lessons-hero h1,
.sanad-hero h1,
.narrators-hero h1,
.quizzes-hero h1,
.quality-hero h1 {
    font-size: clamp(28px, 4vw, 44px);
    margin: 0 0 14px;
    line-height: 1.45;
}

.ht-hero p,
.hero p,
.home-hero p,
.learning-hero p,
.lessons-hero p,
.sanad-hero p,
.narrators-hero p,
.quizzes-hero p,
.quality-hero p {
    color: #e2e8f0;
    line-height: 2.2;
    max-width: 880px;
}

/* Unified cards */
.ht-card,
.ds-card,
.card,
.lesson-card,
.term-card,
.narrator-card,
.quiz-card,
.reference-card,
.sanad-case-card {
    background: rgba(255,255,255,.96);
    border: 1px solid var(--ht-border);
    border-radius: var(--ht-radius-lg);
    box-shadow: 0 12px 36px rgba(15,23,42,.045);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.ht-card:hover,
.ds-card:hover,
.card:hover,
.lesson-card:hover,
.term-card:hover,
.narrator-card:hover,
.quiz-card:hover,
.reference-card:hover,
.sanad-case-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ht-shadow-hover);
    border-color: rgba(214,168,79,.55);
}

/* Grid utilities */
.ht-grid-3,
.feature-grid,
.cards-grid,
.lessons-grid,
.narrators-grid,
.quizzes-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.ht-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 18px;
}

/* Buttons */
.ds-btn,
.ht-btn,
button,
input[type="submit"] {
    font-family: inherit;
}

.ds-btn,
.ht-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 999px;
    padding: 11px 18px;
    font-weight: 900;
    text-decoration: none;
    border: 0;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.ds-btn:hover,
.ht-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(15,23,42,.13);
}

.ds-btn-primary,
.ht-btn-primary {
    background: var(--ht-primary);
    color: #fff;
}

.ds-btn-gold,
.ht-btn-gold {
    background: linear-gradient(135deg, #d6a84f, #f3d37c);
    color: #111827;
}

.ds-btn-dark,
.ht-btn-dark {
    background: var(--ht-dark);
    color: #fff;
}

/* Lesson pages readability */
.lesson-content,
.content-page,
.article-content,
.dossier-content {
    background: #fff;
    border: 1px solid var(--ht-border);
    border-radius: var(--ht-radius-xl);
    padding: 34px;
    box-shadow: var(--ht-shadow-soft);
    line-height: 2.25;
    font-size: 16px;
}

.lesson-content h1,
.lesson-content h2,
.lesson-content h3,
.content-page h1,
.content-page h2,
.content-page h3 {
    color: var(--ht-primary);
    line-height: 1.7;
}

.lesson-content p,
.content-page p,
.article-content p {
    max-width: 900px;
}

/* Academic callouts */
.ht-note,
.ht-tip,
.ht-warning,
.ht-source,
.lesson-note,
.lesson-warning,
.ds-note {
    border-radius: 18px;
    padding: 16px 18px;
    margin: 18px 0;
    line-height: 2.1;
}

.ht-note,
.lesson-note,
.ds-note {
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    border-right: 6px solid #16a34a;
}

.ht-warning,
.lesson-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-right: 6px solid #d97706;
}

.ht-source {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-right: 6px solid #2563eb;
}

/* Tables */
table {
    border-radius: 16px;
    overflow: hidden;
}

table th {
    background: #f1f5f9;
    color: var(--ht-primary);
}

table td,
table th {
    border-color: #e2e8f0 !important;
}

/* Footer */
.ht-footer,
.site-footer,
footer {
    margin-top: 60px;
    background: #0f172a;
    color: #cbd5e1;
    border-top: 5px solid var(--ht-gold);
}

/* Floating quick links */
.ht-floating-tools {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ht-floating-tools a,
.ht-floating-tools button {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 0;
    background: #064e3b;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px rgba(15,23,42,.2);
    text-decoration: none;
    cursor: pointer;
    font-weight: 900;
}

/* Page title badge */
.ht-page-badge,
.ds-kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(214,168,79,.16);
    color: #f8d37b;
    border: 1px solid rgba(214,168,79,.35);
    border-radius: 999px;
    padding: 6px 13px;
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 10px;
}

/* Forms */
input,
select,
textarea {
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--ht-primary) !important;
    box-shadow: 0 0 0 4px rgba(6,78,59,.10);
}

/* Responsive */
@media (max-width: 980px) {
    .ht-grid-3,
    .feature-grid,
    .cards-grid,
    .lessons-grid,
    .narrators-grid,
    .quizzes-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }

    .ht-search-form {
        min-width: 100%;
        max-width: 100%;
        order: 10;
        margin-top: 10px;
    }
}

@media (max-width: 680px) {
    .ht-grid-3,
    .ht-grid-2,
    .feature-grid,
    .cards-grid,
    .lessons-grid,
    .narrators-grid,
    .quizzes-grid {
        grid-template-columns: 1fr;
    }

    .ht-hero,
    .hero,
    .home-hero,
    .learning-hero,
    .lessons-hero,
    .sanad-hero,
    .narrators-hero,
    .quizzes-hero,
    .quality-hero {
        padding: 24px;
        border-radius: 22px;
    }

    .lesson-content,
    .content-page,
    .article-content,
    .dossier-content {
        padding: 22px;
    }

    .ht-floating-tools {
        left: 12px;
        bottom: 12px;
    }
}

/* Print polish */
@media print {
    .ht-header,
    .ht-footer,
    .ht-floating-tools,
    .ht-search-form {
        display: none !important;
    }

    body {
        background: #fff !important;
    }

    .lesson-content,
    .content-page,
    .article-content,
    .dossier-content,
    .ht-card,
    .ds-card,
    .card {
        box-shadow: none !important;
        border-color: #ddd !important;
    }
}