/* =========================================================================
   AirForShare - application styles
   Built on top of Bootstrap 5.3. Light and dark themes are driven by the
   data-bs-theme attribute on <html>.
   ========================================================================= */

:root {
    --afs-page-bg: #f5f6f8;
    --afs-surface: #ffffff;
    --afs-surface-2: #fbfcfd;
    --afs-border: #e2e5ea;
    --afs-border-strong: #ced3db;
    --afs-text: #1b2130;
    --afs-muted: #626a79;
    --afs-accent: #2563eb;
    --afs-accent-hover: #1d4ed8;
    --afs-accent-soft: #edf3ff;
    --afs-success: #15803d;
    --afs-success-soft: #eaf7ef;
    --afs-danger: #b42318;
    --afs-danger-soft: #fdeceb;
    --afs-warning: #b45309;
    --afs-warning-soft: #fdf3e7;
    --afs-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .18);
    --afs-radius: 12px;
    --afs-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

[data-bs-theme="dark"] {
    --afs-page-bg: #0f1319;
    --afs-surface: #161b23;
    --afs-surface-2: #1b212b;
    --afs-border: #272e3a;
    --afs-border-strong: #36404f;
    --afs-text: #e6e9ef;
    --afs-muted: #98a1b1;
    --afs-accent: #60a5fa;
    --afs-accent-hover: #7db5fb;
    --afs-accent-soft: rgba(96, 165, 250, .12);
    --afs-success: #4ade80;
    --afs-success-soft: rgba(74, 222, 128, .12);
    --afs-danger: #f87171;
    --afs-danger-soft: rgba(248, 113, 113, .12);
    --afs-warning: #fbbf24;
    --afs-warning-soft: rgba(251, 191, 36, .12);
    --afs-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -14px rgba(0, 0, 0, .7);
}

body {
    background-color: var(--afs-page-bg);
    color: var(--afs-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1 0 auto; }

a { color: var(--afs-accent); text-decoration: none; }
a:hover { color: var(--afs-accent-hover); text-decoration: underline; }

h1, h2, h3, h4 { color: var(--afs-text); letter-spacing: -.015em; }
.text-secondary { color: var(--afs-muted) !important; }

.skip-link {
    position: absolute;
    top: .5rem;
    left: .5rem;
    z-index: 1080;
    background: var(--afs-surface);
    padding: .5rem .75rem;
    border-radius: 8px;
}

/* ---------------------------------------------------------------- header */

.site-header {
    background: color-mix(in srgb, var(--afs-surface) 92%, transparent);
    border-bottom: 1px solid var(--afs-border);
    position: sticky;
    top: 0;
    z-index: 1030;
    backdrop-filter: saturate(180%) blur(8px);
}

.navbar-brand { color: var(--afs-text); font-weight: 650; letter-spacing: -.02em; }
.navbar-brand:hover { color: var(--afs-text); text-decoration: none; }

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--afs-accent);
    color: #fff;
}

.site-header .nav-link { color: var(--afs-muted); font-weight: 500; border-radius: 8px; padding: .4rem .75rem; }
.site-header .nav-link:hover,
.site-header .nav-link.active { color: var(--afs-text); background: var(--afs-surface-2); text-decoration: none; }

.theme-toggle {
    --bs-btn-color: var(--afs-muted);
    --bs-btn-border-color: var(--afs-border);
    --bs-btn-hover-bg: var(--afs-surface-2);
    --bs-btn-hover-color: var(--afs-text);
    --bs-btn-hover-border-color: var(--afs-border-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
}

.theme-icon-dark { display: none; }
[data-bs-theme="dark"] .theme-icon-light { display: none; }
[data-bs-theme="dark"] .theme-icon-dark { display: inline; }

/* ------------------------------------------------------------------ hero */

.hero { padding: 3.5rem 0 2rem; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 680; margin-bottom: .75rem; }
.hero p { color: var(--afs-muted); font-size: 1.05rem; max-width: 34rem; margin: 0 auto; }

.hero-badges { gap: .5rem; }
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--afs-surface);
    border: 1px solid var(--afs-border);
    color: var(--afs-muted);
    border-radius: 999px;
    padding: .35rem .8rem;
    font-size: .82rem;
    font-weight: 500;
}

/* --------------------------------------------------------------- surface */

.surface {
    background: var(--afs-surface);
    border: 1px solid var(--afs-border);
    border-radius: var(--afs-radius);
    box-shadow: var(--afs-shadow);
}

.surface-flat {
    background: var(--afs-surface);
    border: 1px solid var(--afs-border);
    border-radius: var(--afs-radius);
}

.surface-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--afs-border);
}

.surface-body { padding: 1.25rem; }

@media (min-width: 768px) {
    .surface-body { padding: 1.75rem; }
}

/* ------------------------------------------------------------------ tabs */

.share-tabs {
    display: flex;
    gap: .25rem;
    padding: .35rem;
    background: var(--afs-surface-2);
    border: 1px solid var(--afs-border);
    border-radius: 10px;
}

.share-tabs .nav-link {
    flex: 1 1 0;
    width: 100%;
    text-align: center;
    border: 0;
    border-radius: 8px;
    color: var(--afs-muted);
    font-weight: 550;
    padding: .55rem .75rem;
}

.share-tabs .nav-link:hover { color: var(--afs-text); }

.share-tabs .nav-link.active {
    background: var(--afs-surface);
    color: var(--afs-text);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}

[data-bs-theme="dark"] .share-tabs .nav-link.active { box-shadow: none; border: 1px solid var(--afs-border); }

/* -------------------------------------------------------------- dropzone */

.dropzone {
    border: 1.5px dashed var(--afs-border-strong);
    border-radius: var(--afs-radius);
    background: var(--afs-surface-2);
    padding: 2.25rem 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

.dropzone:hover, .dropzone:focus-visible {
    border-color: var(--afs-accent);
    background: var(--afs-accent-soft);
    outline: none;
}

.dropzone.is-dragover {
    border-color: var(--afs-accent);
    background: var(--afs-accent-soft);
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--afs-accent-soft);
    color: var(--afs-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .85rem;
}

.dropzone h3 { font-size: 1.02rem; font-weight: 600; margin-bottom: .3rem; }
.dropzone p { color: var(--afs-muted); font-size: .88rem; margin-bottom: 0; }

/* ------------------------------------------------------------- file list */

.file-list { display: flex; flex-direction: column; gap: .5rem; }

.file-row {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .7rem .85rem;
    border: 1px solid var(--afs-border);
    border-radius: 10px;
    background: var(--afs-surface);
}

.file-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: var(--afs-surface-2);
    border: 1px solid var(--afs-border);
    color: var(--afs-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    overflow: hidden;
}

.file-main { flex: 1 1 auto; min-width: 0; }

.file-name {
    font-weight: 550;
    font-size: .92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta { color: var(--afs-muted); font-size: .8rem; }

.file-row .progress { height: 4px; margin-top: .45rem; background: var(--afs-surface-2); }
.file-row .progress-bar { background-color: var(--afs-accent); }

.file-remove {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: var(--afs-muted);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.file-remove:hover { background: var(--afs-danger-soft); color: var(--afs-danger); }

.file-status { font-size: .78rem; font-weight: 600; }
.file-status.is-done { color: var(--afs-success); }
.file-status.is-error { color: var(--afs-danger); }

/* --------------------------------------------------------------- options */

.option-label { font-size: .82rem; font-weight: 600; color: var(--afs-muted); margin-bottom: .3rem; }

.form-control, .form-select {
    background-color: var(--afs-surface);
    border-color: var(--afs-border);
    color: var(--afs-text);
}

.form-control:focus, .form-select:focus {
    background-color: var(--afs-surface);
    border-color: var(--afs-accent);
    color: var(--afs-text);
    box-shadow: 0 0 0 3px var(--afs-accent-soft);
}

.form-control::placeholder { color: var(--afs-muted); opacity: .8; }

.form-text { color: var(--afs-muted); }

.btn-primary {
    --bs-btn-bg: var(--afs-accent);
    --bs-btn-border-color: var(--afs-accent);
    --bs-btn-hover-bg: var(--afs-accent-hover);
    --bs-btn-hover-border-color: var(--afs-accent-hover);
    --bs-btn-active-bg: var(--afs-accent-hover);
    --bs-btn-active-border-color: var(--afs-accent-hover);
    --bs-btn-disabled-bg: var(--afs-accent);
    --bs-btn-disabled-border-color: var(--afs-accent);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-color: #fff;
    font-weight: 550;
}

[data-bs-theme="dark"] .btn-primary {
    --bs-btn-color: #0b1220;
    --bs-btn-hover-color: #0b1220;
    --bs-btn-active-color: #0b1220;
    --bs-btn-disabled-color: #0b1220;
}

.btn-outline-secondary {
    --bs-btn-color: var(--afs-text);
    --bs-btn-border-color: var(--afs-border-strong);
    --bs-btn-hover-bg: var(--afs-surface-2);
    --bs-btn-hover-color: var(--afs-text);
    --bs-btn-hover-border-color: var(--afs-border-strong);
    --bs-btn-active-bg: var(--afs-surface-2);
    --bs-btn-active-color: var(--afs-text);
}

.advanced-toggle {
    background: none;
    border: 0;
    padding: 0;
    color: var(--afs-accent);
    font-size: .88rem;
    font-weight: 550;
}

.advanced-toggle:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- result */

.result-code {
    font-family: var(--afs-mono);
    font-size: clamp(1.8rem, 6vw, 2.4rem);
    font-weight: 700;
    letter-spacing: .18em;
    color: var(--afs-text);
    word-break: break-all;
}

.copy-field .form-control {
    font-family: var(--afs-mono);
    font-size: .88rem;
    background: var(--afs-surface-2);
}

.qr-box {
    background: #fff;
    border: 1px solid var(--afs-border);
    border-radius: 10px;
    padding: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 148px;
    min-height: 148px;
}

.qr-box img,
.qr-box canvas,
.qr-box svg { display: block; width: 128px; height: 128px; }

.meta-list { display: grid; gap: .6rem; }

.meta-item { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; }
.meta-item dt { color: var(--afs-muted); font-weight: 500; }
.meta-item dd { margin: 0; font-weight: 550; text-align: right; }

.notice {
    border-radius: 10px;
    padding: .85rem 1rem;
    font-size: .9rem;
    border: 1px solid transparent;
}

.notice-info { background: var(--afs-accent-soft); border-color: color-mix(in srgb, var(--afs-accent) 25%, transparent); color: var(--afs-text); }
.notice-success { background: var(--afs-success-soft); border-color: color-mix(in srgb, var(--afs-success) 30%, transparent); color: var(--afs-text); }
.notice-warning { background: var(--afs-warning-soft); border-color: color-mix(in srgb, var(--afs-warning) 30%, transparent); color: var(--afs-text); }
.notice-danger { background: var(--afs-danger-soft); border-color: color-mix(in srgb, var(--afs-danger) 30%, transparent); color: var(--afs-text); }

/* --------------------------------------------------------------- receive */

.receive-input {
    font-family: var(--afs-mono);
    font-size: 1.25rem;
    letter-spacing: .28em;
    text-transform: uppercase;
    text-align: center;
    font-weight: 600;
}

.receive-input::placeholder { letter-spacing: .18em; font-weight: 400; }

/* -------------------------------------------------------------- features */

.feature-card { height: 100%; padding: 1.4rem; }

.feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--afs-accent-soft);
    color: var(--afs-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .9rem;
}

.feature-card h3 { font-size: 1rem; font-weight: 620; margin-bottom: .4rem; }
.feature-card p { color: var(--afs-muted); font-size: .9rem; margin-bottom: 0; }

.step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--afs-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 650;
    flex: 0 0 auto;
}

[data-bs-theme="dark"] .step-number { color: #0b1220; }

/* ----------------------------------------------------------- share view */

.text-preview {
    font-family: var(--afs-mono);
    font-size: .88rem;
    line-height: 1.65;
    background: var(--afs-surface-2);
    border: 1px solid var(--afs-border);
    border-radius: 10px;
    padding: 1rem;
    margin: 0;
    max-height: 28rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--afs-text);
}

.countdown { font-variant-numeric: tabular-nums; }
.countdown.is-urgent { color: var(--afs-danger); }

.state-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.state-icon.is-error { background: var(--afs-danger-soft); color: var(--afs-danger); }
.state-icon.is-lock { background: var(--afs-warning-soft); color: var(--afs-warning); }
.state-icon.is-success { background: var(--afs-success-soft); color: var(--afs-success); }

/* ---------------------------------------------------------------- tables */

.table-surface {
    --bs-table-bg: transparent;
    --bs-table-color: var(--afs-text);
    --bs-table-border-color: var(--afs-border);
    margin-bottom: 0;
}

.table-surface th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--afs-muted);
    font-weight: 650;
    white-space: nowrap;
}

.table-surface td { vertical-align: middle; font-size: .9rem; }

.stat-card { padding: 1.1rem 1.25rem; }
.stat-card .stat-label { color: var(--afs-muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 680; letter-spacing: -.02em; }

.badge-soft {
    background: var(--afs-surface-2);
    border: 1px solid var(--afs-border);
    color: var(--afs-muted);
    font-weight: 600;
    font-size: .72rem;
    padding: .28rem .55rem;
    border-radius: 6px;
    display: inline-block;
}

.badge-soft.is-active { background: var(--afs-success-soft); border-color: transparent; color: var(--afs-success); }
.badge-soft.is-expired { background: var(--afs-danger-soft); border-color: transparent; color: var(--afs-danger); }
.badge-soft.is-pending { background: var(--afs-warning-soft); border-color: transparent; color: var(--afs-warning); }

/* ---------------------------------------------------------------- toasts */

.toast-stack {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: min(22rem, calc(100vw - 2rem));
}

.afs-toast {
    background: var(--afs-surface);
    border: 1px solid var(--afs-border);
    border-left: 3px solid var(--afs-accent);
    border-radius: 10px;
    box-shadow: var(--afs-shadow);
    padding: .7rem .9rem;
    font-size: .88rem;
    color: var(--afs-text);
    animation: afs-toast-in .18s ease-out;
}

.afs-toast.is-success { border-left-color: var(--afs-success); }
.afs-toast.is-error { border-left-color: var(--afs-danger); }

@keyframes afs-toast-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- footer */

.site-footer {
    border-top: 1px solid var(--afs-border);
    background: var(--afs-surface);
    padding: 2rem 0;
    margin-top: 3.5rem;
}

.footer-links a { color: var(--afs-muted); }
.footer-links a:hover { color: var(--afs-text); }

/* ------------------------------------------------------------- installer */

.install-step {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .88rem;
    color: var(--afs-muted);
    font-weight: 550;
}

.install-step .dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--afs-border-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
}

.install-step.is-current { color: var(--afs-text); }
.install-step.is-current .dot { background: var(--afs-accent); border-color: var(--afs-accent); color: #fff; }
.install-step.is-done .dot { background: var(--afs-success-soft); border-color: transparent; color: var(--afs-success); }

.check-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--afs-border); }
.check-row:last-child { border-bottom: 0; }
.check-row .check-name { font-size: .9rem; font-weight: 550; }
.check-row .check-hint { font-size: .8rem; color: var(--afs-muted); }

/* -------------------------------------------------------------- utility */

.text-mono { font-family: var(--afs-mono); }
.hidden { display: none !important; }
.fw-550 { font-weight: 550; }

@media (max-width: 575.98px) {
    .hero { padding: 2.25rem 0 1.5rem; }
    .surface-body { padding: 1.1rem; }
    .meta-item { flex-direction: column; gap: .1rem; }
    .meta-item dd { text-align: left; }
    .toast-stack { left: 1rem; right: 1rem; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
