:root {
    --primary-color: #08785f;
    --primary: #08785f;
    --primary-dark: #075e4c;
    --primary-soft: #e9f7f2;
    --accent: #d9a928;
    --success-color: #14855f;
    --danger-color: #c93c4a;
    --warning-color: #c47b13;
    --info-color: #286ca8;
    --secondary-color: #f4f7f6;
    --light-color: #f8faf9;
    --dark-color: #13261f;
    --white: #fff;
    --gray: #61716b;
    --gray-light: #e1e9e6;
    --border: #dce6e2;
    --surface: #fff;
    --surface-muted: #f5f8f7;
    --text: #14241f;
    --muted: #66756f;
    --border-radius: 16px;
    --shadow-sm: 0 2px 10px rgba(13, 46, 36, .05);
    --shadow: 0 16px 40px rgba(13, 46, 36, .09);
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    min-width: 320px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    direction: rtl;
    line-height: 1.75;
    color: var(--text);
    background:
        radial-gradient(circle at 92% 0, rgba(8, 120, 95, .12), transparent 28rem),
        linear-gradient(180deg, #f7faf9 0, #eef4f2 100%);
    accent-color: var(--primary);
}

body::after {
    content: "";
    position: fixed;
    inset: auto -7rem -9rem auto;
    width: 24rem;
    height: 24rem;
    border: 4rem solid rgba(217, 169, 40, .045);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); }
img, svg, canvas, video { max-width: 100%; }
p { margin: .25rem 0 1rem; }
hr { margin: 1.5rem 0; border: 0; border-top: 1px solid var(--border); }
bdi { direction: ltr; unicode-bidi: isolate; }

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 .8rem;
    color: var(--dark-color);
    line-height: 1.45;
    letter-spacing: -.025em;
}

h1 { font-size: clamp(1.5rem, 3vw, 2.15rem); }
h2 { font-size: clamp(1.25rem, 2.5vw, 1.65rem); }
h3 { font-size: 1.1rem; }

.container {
    width: min(100% - 32px, 1120px);
    margin-inline: auto;
    padding: 24px 0 72px;
}

.container > main { width: min(100%, 860px); margin-inline: auto; }

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.flow-header { justify-content: flex-start; gap: 10px; }
.flow-header .site-brand { flex: 0 0 auto; }
.flow-header .header-links { margin-inline-start: auto; }

.site-brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); }
.site-brand:hover { color: var(--text); }
.site-brand > span:last-child { display: grid; }
.site-brand strong { font-size: 1.08rem; line-height: 1.35; }
.site-brand small { color: var(--muted); font-size: .72rem; }

.brand-mark {
    display: block;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    object-fit: cover;
    background: #fff;
    border: 1px solid rgba(8, 120, 95, .16);
    border-radius: 50%;
    box-shadow: 0 8px 22px rgba(8, 120, 95, .22);
}

.ticket-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--border);
}
.ticket-brand img { width: 58px; height: 58px; object-fit: cover; border-radius: 50%; }
.ticket-brand-copy { display: grid; line-height: 1.45; }
.ticket-brand-copy strong { color: var(--primary-dark); font-size: 1.05rem; }
.ticket-brand-copy small { color: var(--muted); font-size: .76rem; }
.ticket-match-title { letter-spacing: normal; word-spacing: normal; }

.history-link {
    padding: 9px 14px;
    color: var(--primary-dark);
    background: rgba(255, 255, 255, .75);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: .84rem;
    font-weight: 700;
    backdrop-filter: blur(8px);
}

.header-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.user-phone {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 39px;
    padding: 7px 10px;
    color: var(--muted);
    background: rgba(255, 255, 255, .58);
    border-radius: 11px;
    font-size: .72rem;
}
.user-phone bdi { color: var(--text); font-size: .82rem; font-weight: 800; }
.user-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .66rem;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}
.user-level-normal {
    color: #475569;
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.user-level-purple {
    color: #6d28d9;
    background: #f3e8ff;
    border-color: #d8b4fe;
}
.user-level-pink {
    color: #be185d;
    background: #fce7f3;
    border-color: #f9a8d4;
}
.user-level-kheybari {
    color: #166534;
    background: #dcfce7;
    border-color: #86efac;
}
.logout-form, .phone-session-actions form { margin: 0; }
.logout-button { min-height: 39px; font-family: inherit; cursor: pointer; }
.danger-text { color: var(--danger-color) !important; border-color: rgba(201, 60, 74, .28) !important; }

.phone-session-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 16px 0 18px;
    padding: 13px 14px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.phone-session-number { display: grid; gap: 2px; }
.phone-session-number span { color: var(--muted); font-size: .75rem; }
.phone-session-number strong { color: var(--primary-dark); font-size: 1.05rem; }
.phone-session-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.card,
.admin-card {
    position: relative;
    margin-bottom: 18px;
    padding: clamp(20px, 4vw, 34px);
    overflow: hidden;
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(211, 224, 219, .9);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #18a47f 70%, var(--accent));
}

.card > :last-child { margin-bottom: 0; }
.eyebrow { margin-bottom: 8px; color: var(--primary); font-size: .78rem; font-weight: 800; letter-spacing: .02em; }
.muted, .form-hint { color: var(--muted); }
.form-hint { margin: 8px 0 14px; font-size: .78rem; text-align: center; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.form-group { margin-bottom: 18px; }
.form-group label, form > label {
    display: block;
    margin-bottom: 7px;
    color: #31453e;
    font-size: .86rem;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    min-height: 48px;
    padding: 10px 13px;
    color: var(--text);
    background: #fbfdfc;
    border: 1px solid #ccd9d4;
    border-radius: 12px;
    outline: none;
    font-size: 16px;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

textarea { min-height: 110px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #9db3aa; }
input:focus, select:focus, textarea:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(8, 120, 95, .11);
}
input:disabled, select:disabled, textarea:disabled, button:disabled { cursor: not-allowed; opacity: .55; }

.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-row .form-group { margin-bottom: 0; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 45px;
    padding: 10px 18px;
    color: #fff;
    background: linear-gradient(135deg, #0a8568, #076650);
    border: 1px solid transparent;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(8, 120, 95, .17);
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform .18s, box-shadow .18s, background .18s;
}

.btn:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 11px 25px rgba(8, 120, 95, .24); }
.btn:active { transform: translateY(0); }
.btn.outline { color: var(--primary-dark); background: #fff; border-color: #b8cbc4; box-shadow: none; }
.btn.outline:hover { color: var(--primary-dark); background: var(--primary-soft); border-color: #8bb5a6; }
.btn.danger { background: #bd3544; box-shadow: none; }
.btn.success, .btn.primary { background: var(--primary); }
.btn.small { min-height: 34px; padding: 6px 10px; border-radius: 9px; font-size: .78rem; }

@keyframes app-button-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
.app-is-loading { cursor: wait !important; pointer-events: none !important; user-select: none !important; }
.app-is-loading:not(input) { color: transparent !important; }
.app-is-loading > *:not(.app-button-spinner) { visibility: hidden !important; }
.app-button-spinner {
    position: absolute !important;
    z-index: 5 !important;
    top: 50% !important;
    left: 50% !important;
    display: block !important;
    width: 19px !important;
    height: 19px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #fff !important;
    background: transparent !important;
    border: 2px solid rgba(255, 255, 255, .42) !important;
    border-top-color: currentColor !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    transform: translate(-50%, -50%);
    animation: app-button-spin .7s linear infinite !important;
    visibility: visible !important;
    pointer-events: none !important;
}
.btn.outline.app-is-loading .app-button-spinner,
.app-is-loading.outline .app-button-spinner {
    color: var(--primary-color, #08785f) !important;
    border-color: rgba(8, 120, 95, .24) !important;
    border-top-color: currentColor !important;
}

.actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

.alert {
    margin: 0 0 16px;
    padding: 12px 14px;
    color: #5f4a16;
    background: #fff9e9;
    border: 1px solid #f1dfa8;
    border-radius: 12px;
    font-size: .87rem;
}
.alert.error { color: #8d2935; background: #fff2f3; border-color: #f2c6cb; }
.alert.success { color: #086046; background: #eaf8f2; border-color: #b9e3d4; }

.match-mini, .person-block, .ticket-h {
    margin-bottom: 12px;
    padding: 16px !important;
    background: var(--surface-muted) !important;
    border: 1px solid var(--border) !important;
    border-radius: 15px !important;
}
.match-mini { display: grid; gap: 4px; color: var(--muted); font-size: .88rem; }
.match-mini > div:first-child { margin-bottom: 4px; color: var(--text); font-size: 1rem; }
.match-public-link { color: var(--text); text-decoration: none; }
.match-public-link:hover { color: var(--primary); }
.seo-home-title { margin: 4px 2px 18px; font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.6; }
.btn.secondary { color: var(--primary-dark); background: #eef7f3; border-color: #c8ddd5; box-shadow: none; }
.btn.secondary:hover { color: var(--primary-dark); background: #e2f2eb; }
.guide-promo { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.guide-promo h2 { margin-bottom: 5px; font-size: 1.08rem; }
.guide-promo p { margin: 0; color: var(--muted); }
.guide-promo .btn { flex: 0 0 auto; }
.archive-promo { margin-bottom: 0; }

.past-matches-page { display: grid; gap: 16px; }
.past-matches-page .guide-hero { margin-bottom: 0; }
.past-matches-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.past-match-card { margin-bottom: 0; padding: 0; overflow: hidden; }
.past-match-card > a { display: grid; min-height: 100%; gap: 13px; padding: 22px; color: inherit; text-decoration: none; transition: background .2s, transform .2s; }
.past-match-card > a:hover { background: #f8fcfa; }
.past-match-card h2 { margin: 0; color: var(--text); font-size: 1.05rem; line-height: 1.8; }
.past-match-meta { display: flex; gap: 7px 14px; flex-wrap: wrap; color: var(--muted); font-size: .78rem; }
.past-match-meta span { display: inline-flex; align-items: center; }
.past-match-result { width: fit-content; padding: 7px 11px; color: var(--primary-dark); background: var(--primary-soft); border-radius: 999px; font-size: .82rem; }
.past-match-more { margin-top: auto; color: var(--primary); font-size: .8rem; font-weight: 800; }
.past-matches-empty { margin: 0; color: var(--muted); text-align: center; }
.archive-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; }
.archive-pagination span { color: var(--muted); font-size: .8rem; }

.public-match-card { overflow: hidden; }
.public-match-card h1, .guide-hero h1 { margin: 4px 0 20px; font-size: clamp(1.45rem, 4vw, 2.35rem); line-height: 1.55; }
.match-kicker { margin: 0; color: var(--primary); font-size: .78rem; font-weight: 800; }
.match-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 22px 0; }
.match-facts > div { display: grid; gap: 6px; padding: 15px; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 14px; }
.match-facts span { color: var(--muted); font-size: .72rem; }
.match-facts strong { color: var(--text); font-size: .9rem; }
.match-facts .match-address { grid-column: span 2; }
.match-result { display: inline-flex; gap: 8px; margin: 0 0 18px; padding: 9px 13px; background: #eef7f3; border-radius: 999px; }
.match-buy-button { margin-bottom: 18px; }
.match-description { margin: 5px 0 0; color: var(--muted); line-height: 2; }
.source-note { color: var(--muted); font-size: .75rem; }

.breadcrumbs { width: 100%; margin: 0 0 14px; color: var(--muted); font-size: .78rem; }
.breadcrumbs ol { display: flex; align-items: center; gap: 7px; margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; }
.breadcrumbs ol::-webkit-scrollbar { display: none; }
.breadcrumbs li { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 7px; white-space: nowrap; }
.breadcrumbs li:not(:last-child)::after { content: "‹"; color: #9aaba4; font-size: 1rem; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--primary); }

.public-footer { width: min(100%, 860px); margin: 28px auto 0; padding: 20px 4px 0; color: var(--muted); border-top: 1px solid var(--border); text-align: center; }
.public-footer nav { display: flex; align-items: center; justify-content: center; gap: 8px 18px; margin-bottom: 10px; flex-wrap: wrap; }
.public-footer a { font-size: .8rem; font-weight: 700; }
.public-footer small { font-size: .7rem; }

.content-page { display: grid; gap: 16px; }
.content-hero { display: flex; align-items: center; gap: 22px; margin-bottom: 0; }
.content-hero h1 { margin: 3px 0 10px; font-size: clamp(1.5rem, 4vw, 2.25rem); }
.content-hero p:last-child { margin: 0; color: var(--muted); line-height: 2; }
.club-intro-mark { flex: 0 0 auto; }
.club-intro-mark img { display: block; border: 1px solid var(--border); border-radius: 50%; box-shadow: var(--shadow-sm); }
.policy-sections { display: grid; gap: 16px; }
.policy-sections .guide-section { margin-bottom: 0; }
.policy-sections .btn { margin-top: 5px; }

.guide-page { display: grid; gap: 16px; }
.guide-hero { margin-bottom: 0; }
.guide-hero p:last-child { margin-bottom: 0; color: var(--muted); }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.guide-section { margin-bottom: 0; }
.guide-section h2, .faq-section h2 { font-size: 1.05rem; }
.guide-section p, .guide-section li { color: #40564e; line-height: 2; }
.guide-section ol, .guide-section ul { margin: 0; padding-right: 22px; }
.faq-section details { padding: 14px 0; border-bottom: 1px solid var(--border); }
.faq-section details:last-child { border-bottom: 0; }
.faq-section summary { color: var(--text); font-weight: 800; cursor: pointer; }
.faq-section details p { margin: 10px 0 0; color: var(--muted); line-height: 2; }
.person-block { position: relative; }

.team-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.team-option {
    display: grid;
    gap: 6px;
    padding: 18px;
    background: #fbfdfc;
    border: 1px solid var(--border);
    border-radius: 15px;
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .2s;
}
.team-option:hover { transform: translateY(-2px); border-color: #86b5a5; }
.team-option:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.team-option input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.team-option span:first-of-type { font-weight: 800; }
.team-option span:last-of-type { color: var(--primary-dark); font-size: .88rem; }

.price-section { margin: 18px 0; padding: 18px; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 15px; }
.price-row, .detail-row, .ticket-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 8px 0; }
.price-row.total, .detail-row.total { margin-top: 8px; padding-top: 14px; border-top: 1px dashed #afc1ba; font-weight: 800; }
.price-row.discount { color: var(--danger-color); }
.ticket-details { width: min(100%, 620px); margin: 24px auto; }

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .84rem; }
.data-table th, .data-table td { padding: 12px 13px; text-align: right; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table th { color: #3c5149; background: #eef4f2; font-weight: 800; white-space: nowrap; }
.data-table th:first-child { border-radius: 0 11px 0 0; }
.data-table th:last-child { border-radius: 11px 0 0 0; }
.data-table tr:hover td { background: #f9fbfa; }

.modal { display: none; position: fixed; z-index: 1000; inset: 0; padding: 20px; overflow-y: auto; background: rgba(5, 25, 19, .58); backdrop-filter: blur(4px); }
.modal-content { position: relative; width: min(100%, 560px); margin: 5vh auto; padding: 26px; background: #fff; border-radius: 20px; box-shadow: 0 24px 70px rgba(0,0,0,.22); }
.close { position: absolute; inset: 18px auto auto 18px; font-size: 1.5rem; cursor: pointer; }

pre { max-width: 100%; overflow: auto; padding: 14px; direction: ltr; color: #d7eee6; background: #12261f !important; border: 0 !important; border-radius: 12px !important; font-size: .76rem; text-align: left; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; min-height: auto; }
.disabled-option { opacity: .5; pointer-events: none; }
.success-card, .error-card { text-align: center; }
.success-icon, .error-icon { margin-bottom: 12px; font-size: 3.6rem; }
.success-icon { color: var(--success-color); }
.error-icon { color: var(--danger-color); }

@media (max-width: 760px) {
    .container { width: min(100% - 22px, 1120px); padding-top: 14px; }
    .site-header { margin-bottom: 14px; }
    .history-link { padding: 8px 10px; font-size: .75rem; }
    .header-links { gap: 6px; flex-wrap: wrap; }
    .site-brand small { display: none; }
    .card, .admin-card { padding: 20px 16px; border-radius: 17px; }
    .form-row, .team-options { grid-template-columns: 1fr; }
    .actions { align-items: stretch; }
    .actions .btn { flex: 1 1 140px; }
    .ticket-row, .detail-row { align-items: flex-start; flex-direction: column; gap: 2px; }
    .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .guide-promo { align-items: stretch; flex-direction: column; }
    .guide-promo .btn { width: 100%; }
    .match-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .guide-grid { grid-template-columns: 1fr; }
    .past-matches-grid { grid-template-columns: 1fr; }
    .content-hero { align-items: flex-start; }
    .club-intro-mark img { width: 72px; height: 72px; }
}

@media (max-width: 520px) {
    .site-header { flex-wrap: wrap; }
    .flow-header { gap: 6px; }
    .flow-header .site-brand { gap: 6px; }
    .flow-header .site-brand strong { font-size: .88rem; }
    .flow-header .brand-mark { width: 36px; height: 36px; }
    .header-links { width: 100%; }
    .header-links > .history-link, .header-links .logout-form { flex: 1 1 40%; text-align: center; }
    .header-links .logout-button { width: 100%; }
    .user-phone { width: 100%; justify-content: center; }
    .phone-session-card { align-items: stretch; flex-direction: column; }
    .phone-session-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .phone-session-actions .btn { width: 100%; }
    .seo-home-title { margin-bottom: 12px; font-size: 1.22rem; }
    .match-facts { grid-template-columns: 1fr 1fr; gap: 8px; }
    .match-facts > div { padding: 12px; }
    .match-facts .match-address { grid-column: 1 / -1; }
    .content-hero { flex-direction: column; gap: 13px; }
    .public-footer nav { gap: 6px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
    .app-button-spinner { animation-duration: 1.4s !important; }
}
