/* ═══ Cafenet — Components (UX layer) ═══ */

/* ─── Spinner ─── */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cn-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-inline-end: 6px;
}
.btn-ghost .spinner { border-color: rgba(28, 25, 23, 0.15); border-top-color: var(--text-1); }
.btn-danger .spinner { border-color: rgba(255, 255, 255, 0.3); border-top-color: #fff; }
.is-loading { cursor: wait; pointer-events: none; opacity: 0.85; }
@keyframes cn-spin { to { transform: rotate(360deg); } }

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(28, 25, 23, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--s-4);
    animation: cn-fadeIn 0.15s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.closing { animation: cn-fadeOut 0.2s ease forwards; }
.modal {
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: var(--s-8) var(--s-6);
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: cn-scaleIn 0.2s ease;
}
.modal-icon { font-size: 42px; margin-bottom: var(--s-4); line-height: 1; }
.modal-title { font-size: var(--fs-xl); font-weight: 700; margin-bottom: var(--s-2); color: var(--text-1); }
.modal-message { color: var(--text-2); font-size: var(--fs-sm); margin-bottom: var(--s-6); line-height: 1.8; }
.modal-actions { display: flex; gap: var(--s-2); }
.modal-actions .btn { flex: 1; }

/* ─── Toast ─── */
.toast {
    position: fixed;
    bottom: var(--s-6);
    left: 50%;
    transform: translate(-50%, 20px);
    background: var(--text-1);
    color: #fff;
    padding: var(--s-3) var(--s-5);
    border-radius: var(--r);
    font-size: var(--fs-sm);
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    gap: var(--s-2);
    align-items: center;
    max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-err { background: var(--danger); }
.toast-ok { background: var(--success); }

/* ─── Validation ─── */
input.is-valid { border-color: var(--success) !important; background: #F0FDF4; }
input.is-invalid { border-color: var(--danger) !important; background: #FEF2F2; }
.form-hint.is-error { color: var(--danger) !important; font-weight: 600; }
.form-hint.is-success { color: var(--success) !important; font-weight: 600; }

/* ─── Nav Toggle (Hamburger) ─── */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    padding: var(--s-2);
    cursor: pointer;
    color: var(--text-1);
    border-radius: var(--r-sm);
    transition: background 0.15s;
}
.nav-toggle:hover { background: var(--surface-hover); }
.nav-toggle svg { width: 24px; height: 24px; display: block; }

@media (max-width: 768px) {
    .nav-toggle { display: flex; align-items: center; justify-content: center; }
    .site-header .container { flex-wrap: wrap; }
    .site-nav {
        width: 100%;
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding-top: var(--s-3);
        border-top: 1px solid var(--border);
        margin-top: var(--s-3);
        gap: var(--s-1);
    }
    .site-nav.open { display: flex; }
    .site-nav a { padding: var(--s-3); text-align: right; }
}



/* ─── How it works ─── */
.how-it-works {
    padding: var(--s-12) 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-top: var(--s-12);
    text-align: center;
}
.how-it-works h2 {
    justify-content: center;
    margin-bottom: var(--s-2);
}
.how-it-works > p { color: var(--text-2); margin-bottom: var(--s-8); }
.how-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--s-6);
    text-align: center;
    position: relative;
}
.how-step { padding: var(--s-4); }
.how-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
    color: #fff;
    font-size: 26px;
    font-weight: 800;
    margin-bottom: var(--s-4);
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.25);
    position: relative;
}
.how-step h3 { font-size: var(--fs-md); margin-bottom: var(--s-2); }
.how-step p { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.8; }

/* ─── Notification Badge ─── */
.badge-notif {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: #fff;
    border-radius: var(--r-full);
    font-size: 10px;
    font-weight: 700;
    margin-inline-start: 4px;
    line-height: 1;
    box-shadow: 0 0 0 2px var(--surface);
    animation: cn-badgePop 0.3s ease;
}



@keyframes cn-badgePop {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ─── Footer links ─── */
.site-footer .footer-links {
    display: flex;
    gap: var(--s-5);
    flex-wrap: wrap;
}
.site-footer .footer-links a {
    color: var(--text-3);
    font-size: var(--fs-xs);
    font-weight: 500;
    transition: color 0.15s;
}
.site-footer .footer-links a:hover {
    color: var(--brand-500);
}
.site-footer .footer-copy {
    display: flex;
    gap: var(--s-4);
    flex-wrap: wrap;
    align-items: center;
}

/* ─── Trust strip ─── */
.trust-strip {
    padding: var(--s-8) 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-top: var(--s-6);
}
.trust-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--s-5);
    text-align: center;
}
.trust-item { padding: var(--s-2); }
.trust-num {
    font-size: var(--fs-2xl);
    font-weight: 800;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
    margin-bottom: var(--s-1);
    letter-spacing: -0.02em;
}
.trust-label {
    color: var(--text-3);
    font-size: var(--fs-xs);
    font-weight: 600;
}

/* ─── Features section ─── */
.features-section {
    padding: var(--s-12) 0;
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--s-5);
    margin-top: var(--s-6);
}
.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-6);
    text-align: center;
    transition: all .2s;
    box-shadow: var(--shadow-xs);
}
.feature-card:hover {
    border-color: var(--brand-200);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.feature-icon {
    font-size: 36px;
    line-height: 1;
    margin-bottom: var(--s-4);
    display: inline-block;
}
.feature-card h3 {
    font-size: var(--fs-md);
    margin-bottom: var(--s-2);
    color: var(--text-1);
}
.feature-card p {
    color: var(--text-2);
    font-size: var(--fs-sm);
    line-height: 1.8;
}

/* ─── Success page ─── */
.success-wrap {
    text-align: center;
    padding: var(--s-12) var(--s-5);
    max-width: 520px;
    margin: 0 auto;
}
.success-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--success-bg);
    color: var(--success);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 52px;
    margin-bottom: var(--s-6);
    animation: cn-successPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 12px 32px rgba(22, 163, 74, 0.15);
}
.success-wrap h1 {
    font-size: var(--fs-2xl);
    margin-bottom: var(--s-3);
    color: var(--text-1);
}
.success-wrap > p {
    color: var(--text-2);
    font-size: var(--fs-md);
    margin-bottom: var(--s-6);
    line-height: 1.8;
}
.success-info {
    background: var(--brand-50);
    border: 1px solid var(--brand-200);
    border-radius: var(--r);
    padding: var(--s-4) var(--s-5);
    margin-bottom: var(--s-6);
    text-align: right;
}
.success-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--s-2) 0;
    font-size: var(--fs-sm);
}
.success-info-row + .success-info-row { border-top: 1px dashed var(--brand-200); padding-top: var(--s-3); margin-top: var(--s-1); }
.success-info-row .label { color: var(--text-2); }
.success-info-row .value { font-weight: 700; color: var(--text-1); }
.success-tips {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: var(--s-4);
    text-align: right;
    margin-bottom: var(--s-6);
}
.success-tips h4 { font-size: var(--fs-sm); margin-bottom: var(--s-2); color: var(--text-1); }
.success-tips p { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.8; }

@keyframes cn-successPop {
    0% { transform: scale(0); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ─── Error pages (404/500) ─── */
.error-wrap {
    text-align: center;
    padding: var(--s-16) var(--s-5);
    max-width: 500px;
    margin: 0 auto;
}
.error-code {
    font-size: clamp(80px, 18vw, 140px);
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: var(--s-4);
    letter-spacing: -0.05em;
}
.error-wrap h1 {
    font-size: var(--fs-xl);
    margin-bottom: var(--s-3);
}
.error-wrap > p {
    color: var(--text-2);
    font-size: var(--fs-md);
    margin-bottom: var(--s-6);
    line-height: 1.8;
}

/* ─── Accessibility ─── */
*:focus-visible {
    outline: 3px solid var(--brand-200);
    outline-offset: 2px;
    border-radius: 4px;
}
.skip-link {
    position: absolute;
    top: -100px;
    right: var(--s-4);
    background: var(--brand-500);
    color: #fff;
    padding: var(--s-2) var(--s-4);
    border-radius: var(--r-sm);
    z-index: 200;
    transition: top 0.2s;
}
.skip-link:focus { top: var(--s-4); color: #fff; }

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ─── Animations ─── */
@keyframes cn-fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cn-fadeOut { to { opacity: 0; } }
@keyframes cn-scaleIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }