/* === css/base/reset.css === */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

body,
h1,
h2,
h3,
p,
ul {
    margin: 0;
}

ul {
    padding-inline-start: 1.2rem;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

textarea {
    resize: vertical;
}

/* === css/base/fonts.css === */
@font-face {
    font-family: 'Dana';
    src: url('/fonts/fonts/Dana-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Dana';
    src: url('/fonts/fonts/Dana-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Dana';
    src: url('/fonts/fonts/Dana-DemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Dana';
    src: url('/fonts/fonts/Dana-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    src: url('/fonts/PlusJakartaSans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    src: url('/fonts/PlusJakartaSans-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    src: url('/fonts/PlusJakartaSans-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    src: url('/fonts/PlusJakartaSans-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* === css/base/tokens.css === */
:root {
    --font-sans: 'Plus Jakarta Sans', 'Segoe UI', 'Tahoma', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
        'Segoe UI Symbol', 'Noto Color Emoji';
    --font-fa: 'Dana', 'Tahoma', ui-sans-serif, system-ui, sans-serif;
    --fy-bg: #faf7f3;
    --fy-surface: rgba(255, 255, 255, 0.88);
    --fy-surface-strong: #ffffff;
    --fy-border: rgba(145, 114, 198, 0.14);
    --fy-text: #3a3153;
    --fy-text-soft: #8d839f;
    --fy-primary: #7b5cf3;
    --fy-primary-soft: rgba(123, 92, 243, 0.12);
    --fy-accent: #f4deba;
    --fy-success: #31a678;
    --fy-danger: #cf5c7a;
    --fy-shadow: 0 18px 50px rgba(106, 84, 153, 0.08);
    color-scheme: light;
}

:root[data-theme='dark'] {
    --fy-bg: #13101d;
    --fy-surface: rgba(30, 25, 43, 0.88);
    --fy-surface-strong: #1b1628;
    --fy-border: rgba(208, 194, 255, 0.12);
    --fy-text: #f6f0ff;
    --fy-text-soft: #bdb3cf;
    --fy-primary: #a68cff;
    --fy-primary-soft: rgba(166, 140, 255, 0.18);
    --fy-accent: #6a5844;
    --fy-success: #57c49a;
    --fy-danger: #ff8ca7;
    --fy-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    color-scheme: dark;
}

:root[data-theme='dark'] body.app-shell--auth {
    --fy-bg: #faf7f3;
    --fy-surface: rgba(255, 255, 255, 0.88);
    --fy-surface-strong: #ffffff;
    --fy-border: rgba(145, 114, 198, 0.14);
    --fy-text: #3a3153;
    --fy-text-soft: #8d839f;
    --fy-primary: #7b5cf3;
    --fy-primary-soft: rgba(123, 92, 243, 0.12);
    --fy-accent: #f4deba;
    --fy-success: #31a678;
    --fy-danger: #cf5c7a;
    --fy-shadow: 0 18px 50px rgba(106, 84, 153, 0.08);
    background: var(--fy-bg);
    color: var(--fy-text);
    color-scheme: light;
}

body {
    min-height: 100vh;
    font-family: var(--font-sans);
    background: var(--fy-bg);
    color: var(--fy-text);
    direction: inherit;
}

html[lang^='fa'] body,
html[dir='rtl'] body,
:lang(fa) {
    font-family: var(--font-fa);
}

input,
select,
textarea,
button {
    direction: inherit;
    text-align: start;
}

html[dir='rtl'] body {
    direction: rtl;
}

html[dir='ltr'] body {
    direction: ltr;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === css/layout/shell.css === */
.app-shell {
    min-height: 100vh;
    position: relative;
}

.app-shell__background {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(125, 94, 245, 0.14), transparent 30%),
        radial-gradient(circle at bottom right, rgba(243, 216, 172, 0.3), transparent 28%);
    pointer-events: none;
}

.app-shell__background::after {
    content: '';
    position: absolute;
    inset: 0;
    background: none;
    transform-origin: center;
}

.app-shell--auth .app-shell__background {
    background:
        linear-gradient(90deg, rgba(250, 247, 255, 0.14) 0%, rgba(248, 245, 255, 0.04) 42%, rgba(252, 250, 255, 0.22) 100%);
}

.app-shell--auth .app-shell__background::after {
    background: url('/assets/auth-background.png') left center / cover no-repeat;
}

.app-shell__frame {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100vw - 2rem));
    margin: 0 auto;
    padding: 1rem 0 2rem;
}

.app-shell--profile-complete .app-shell__frame {
    width: min(720px, calc(100vw - 1.4rem));
}

.app-shell--auth .app-shell__frame {
    width: min(100vw - 2rem, 1480px);
    padding: 1rem 0;
}

/* === css/components/shared.css === */
.topbar,
.card-shell,
.beauty-card,
.flash {
    backdrop-filter: blur(18px);
    background: var(--fy-surface);
    border: 1px solid var(--fy-border);
    box-shadow: var(--fy-shadow);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.2rem;
    border-radius: 1.5rem;
    margin-bottom: 1rem;
}

.topbar--overlay {
    background: rgba(255, 255, 255, 0.52);
    border-color: rgba(198, 184, 233, 0.26);
    box-shadow: 0 22px 55px rgba(124, 96, 189, 0.08);
}

.app-shell--auth .topbar {
    padding: 0.8rem 1rem;
    margin-bottom: 0.8rem;
}

.topbar__actions,
.inline-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
}

.brand__logo {
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    object-fit: contain;
}

.brand strong,
.section-heading h1,
.section-heading h2 {
    display: block;
    font-size: clamp(1.5rem, 1.1rem + 1vw, 2.5rem);
    font-weight: 700;
}

.brand small,
.section-heading p,
.support-copy {
    color: var(--fy-text-soft);
}

.select-pill,
.ghost-button,
.primary-button,
.method-button,
.stack-form input,
.stack-form select,
.stack-form textarea,
.field-card input,
.field-card select,
.admin-card input,
.admin-card textarea,
.admin-card select {
    border-radius: 1rem;
    border: 1px solid var(--fy-border);
}

.select-pill,
.stack-form input,
.stack-form select,
.stack-form textarea,
.field-card input,
.field-card select,
.admin-card input,
.admin-card textarea,
.admin-card select {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.85);
}

:root[data-theme='dark'] .select-pill,
:root[data-theme='dark'] .stack-form input,
:root[data-theme='dark'] .stack-form select,
:root[data-theme='dark'] .stack-form textarea,
:root[data-theme='dark'] .field-card input,
:root[data-theme='dark'] .field-card select,
:root[data-theme='dark'] .admin-card input,
:root[data-theme='dark'] .admin-card textarea,
:root[data-theme='dark'] .admin-card select {
    background: rgba(18, 16, 28, 0.8);
}

:root[data-theme='dark'] body.app-shell--auth .select-pill,
:root[data-theme='dark'] body.app-shell--auth .stack-form input,
:root[data-theme='dark'] body.app-shell--auth .stack-form select,
:root[data-theme='dark'] body.app-shell--auth .stack-form textarea,
:root[data-theme='dark'] body.app-shell--auth .field-card input,
:root[data-theme='dark'] body.app-shell--auth .field-card select,
:root[data-theme='dark'] body.app-shell--auth .admin-card input,
:root[data-theme='dark'] body.app-shell--auth .admin-card textarea,
:root[data-theme='dark'] body.app-shell--auth .admin-card select {
    background: rgba(255, 255, 255, 0.86);
    color: var(--fy-text);
    border-color: var(--fy-border);
}

.ghost-button,
.primary-button,
.method-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.9rem 1.1rem;
    font-weight: 600;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.primary-button {
    color: white;
    background: linear-gradient(135deg, var(--fy-primary), #946dff);
}

.primary-button.is-loading,
.method-button.is-loading,
.ghost-button.is-loading {
    opacity: 0.72;
    pointer-events: none;
}

.ghost-button,
.method-button {
    background: rgba(255, 255, 255, 0.55);
}

:root[data-theme='dark'] .ghost-button,
:root[data-theme='dark'] .method-button {
    background: rgba(43, 35, 65, 0.9);
}

:root[data-theme='dark'] body.app-shell--auth .ghost-button,
:root[data-theme='dark'] body.app-shell--auth .method-button {
    background: rgba(255, 255, 255, 0.62);
    color: var(--fy-text);
    border-color: var(--fy-border);
}

.ghost-button:hover,
.primary-button:hover,
.method-button:hover {
    transform: translateY(-1px);
}

.flash {
    border-radius: 1rem;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
}

.flash--success {
    border-color: rgba(49, 166, 120, 0.2);
}

.flash--error {
    border-color: rgba(207, 92, 122, 0.2);
}

.page-content {
    display: grid;
    gap: 1.5rem;
}

.page-content--auth {
    min-height: calc(100vh - 5.9rem);
    align-items: stretch;
}

html[dir='rtl'] .topbar,
html[dir='rtl'] .brand,
html[dir='rtl'] .topbar__actions,
html[dir='rtl'] .inline-form {
    flex-direction: row-reverse;
}

html[dir='rtl'] .section-heading,
html[dir='rtl'] .support-copy,
html[dir='rtl'] .stack-form label,
html[dir='rtl'] .field-card,
html[dir='rtl'] .admin-card,
html[dir='rtl'] .flash,
html[dir='rtl'] .metric-card {
    text-align: right;
}

html[dir='rtl'] .method-button--switch {
    justify-content: flex-end;
}

html[dir='rtl'] .admin-card__header,
html[dir='rtl'] .section-heading--row {
    flex-direction: row-reverse;
}

.card-shell {
    border-radius: 2rem;
    padding: 1.5rem;
}

.card-shell--narrow {
    width: min(760px, 100%);
    margin: 0 auto;
}

.section-heading {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.section-heading--row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.eyebrow {
    color: var(--fy-primary);
    letter-spacing: 0.08em;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.77rem;
}

.dashboard-grid,
.metric-grid {
    display: grid;
    gap: 1rem;
}

.dashboard-home {
    display: grid;
    gap: 1rem;
}

.dashboard-hero,
.dashboard-panel {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(247, 242, 255, 0.78)),
        rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(215, 201, 241, 0.78);
    box-shadow: 0 26px 60px rgba(109, 84, 179, 0.08);
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
}

.dashboard-hero__copy {
    display: grid;
    gap: 0.6rem;
}

.dashboard-hero__copy h1 {
    margin: 0;
    font-size: clamp(1.9rem, 3vw, 2.8rem);
}

.dashboard-hero__copy p {
    max-width: 58ch;
    color: var(--fy-text-soft);
    line-height: 1.8;
}

.dashboard-hero__identity {
    min-width: 220px;
    display: grid;
    gap: 0.35rem;
    padding: 1rem 1.1rem;
    border-radius: 1.35rem;
    border: 1px solid rgba(211, 197, 240, 0.85);
    background: rgba(255, 255, 255, 0.7);
    text-align: start;
}

.dashboard-hero__identity strong {
    font-size: 1.08rem;
}

.dashboard-hero__identity span,
.dashboard-detail-item span,
.dashboard-security-item span {
    color: var(--fy-text-soft);
}

.dashboard-metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.dashboard-home__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.dashboard-panel {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.dashboard-panel--admin {
    grid-column: 1 / -1;
}

.dashboard-panel--highlight {
    border: 1px solid rgba(139, 92, 246, 0.28);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(245, 240, 255, 0.88));
}

.dashboard-detail-list,
.dashboard-security-strip {
    display: grid;
    gap: 0.85rem;
}

.dashboard-detail-item,
.dashboard-security-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(215, 201, 241, 0.76);
    background: rgba(255, 255, 255, 0.65);
}

.dashboard-detail-item strong,
.dashboard-security-item strong {
    font-size: 0.98rem;
}

.metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metric-card {
    padding: 1rem;
    border-radius: 1.25rem;
    border: 1px solid var(--fy-border);
    background: rgba(255, 255, 255, 0.45);
}

.metric-card strong {
    display: block;
    font-size: 1.3rem;
}

.metric-card span {
    color: var(--fy-text-soft);
}

/* === css/errors/not-found.css === */
/* 404 Not Found */

.not-found-page {
    min-height: calc(100vh - 4rem);
    display: grid;
    place-items: center;
    padding: 2rem 1rem 3rem;
}

.not-found-card {
    width: min(100%, 42rem);
    padding: clamp(1.75rem, 4vw, 2.75rem);
    text-align: center;
    border-radius: 1.75rem;
    border: 1px solid rgba(213, 200, 238, 0.72);
    background:
        radial-gradient(circle at 100% 0%, rgba(123, 92, 243, 0.12), transparent 42%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(248, 244, 255, 0.9));
    box-shadow: 0 28px 60px rgba(109, 84, 179, 0.12);
}

.not-found-card__code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5.5rem;
    min-height: 5.5rem;
    margin-bottom: 1rem;
    border-radius: 1.35rem;
    background: rgba(123, 92, 243, 0.1);
    color: var(--fy-primary);
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.not-found-card h1 {
    margin: 0 0 0.65rem;
    font-size: clamp(1.65rem, 3vw, 2.15rem);
    letter-spacing: -0.03em;
}

.not-found-card p {
    margin: 0 auto;
    max-width: 38ch;
    color: var(--fy-text-soft);
    line-height: 1.65;
    font-size: 0.96rem;
}

.not-found-card__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.not-found-card__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.85rem;
    padding: 0.75rem 1.15rem;
    border-radius: 0.95rem;
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.not-found-card__btn--primary {
    background: linear-gradient(135deg, #8b6cf8, #7b5cf3);
    color: #fff;
    box-shadow: 0 12px 28px rgba(123, 92, 243, 0.24);
}

.not-found-card__btn--ghost {
    background: #fff;
    border: 1px solid rgba(145, 114, 198, 0.2);
    color: var(--fy-text);
}

@media (max-width: 640px) {
    .not-found-card__actions {
        flex-direction: column;
    }

    .not-found-card__btn {
        width: 100%;
    }
}
