/* ============================================================
   PlanSama — Main Stylesheet
   Palette: Rose Quartz Evening
   Fonts:   ApfelGrotezk (Regular 400 / Bold 700)
   ============================================================ */

/* ── Font Faces ─────────────────────────────────────────────── */

@font-face {
    font-family: 'ApfelGrotezk';
    src: url('/assets/fonts/ApfelGrotezk-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'ApfelGrotezk';
    src: url('/assets/fonts/ApfelGrotezk-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

[x-cloak] { display: none !important; }

/* ── Base ────────────────────────────────────────────────────── */

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'ApfelGrotezk', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

input, select, textarea, button {
    font-family: inherit;
}

::selection {
    background: rgba(180, 68, 70, 0.15);
    color: #64242F;
}


/* ── Alpine.js cloak ────────────────────────────────────────── */

[x-cloak] {
    display: none !important;
}


/* ── Skip to Content (accessibility) ────────────────────────── */

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.75rem 1.25rem;
    background: #64242F;
    color: #fff;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 0 0 0.75rem 0.75rem;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}


/* ── Focus & Accessibility ──────────────────────────────────── */

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid #64242F;
    outline-offset: 2px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px #B44446;
    border-color: #B44446;
}


/* ── Form Inputs ────────────────────────────────────────────── */

.ps-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #DFD9D8;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    color: #1f2937;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ps-input::placeholder {
    color: #a89e9c;
}

.ps-input:hover {
    border-color: #c4bcba;
}

.ps-input:focus {
    border-color: #B44446;
    box-shadow: 0 0 0 3px rgba(180, 68, 70, 0.12);
}

.ps-input-error {
    border-color: #dc2626;
}

.ps-input:disabled,
.ps-input[readonly] {
    background: #f3f0ef;
    color: #8d8381;
    cursor: not-allowed;
}

.ps-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: #64242F;
    margin-bottom: 0.375rem;
}

.ps-helper {
    display: block;
    font-size: 0.8125rem;
    color: #a89e9c;
    margin-top: 0.25rem;
}

.ps-error {
    display: block;
    font-size: 0.8125rem;
    color: #dc2626;
    margin-top: 0.25rem;
}


/* ── Buttons ────────────────────────────────────────────────── */

.ps-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 700;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.4;
}

.ps-btn:disabled,
.ps-btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.ps-btn-primary {
    background: #B44446;
    color: #fff;
}

.ps-btn-primary:hover {
    background: #64242F;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(100, 36, 47, 0.25);
}

.ps-btn-primary:active {
    transform: translateY(0);
}

.ps-btn-secondary {
    background: transparent;
    color: #B44446;
    border: 1.5px solid #DFD9D8;
}

.ps-btn-secondary:hover {
    border-color: #B44446;
    background: rgba(180, 68, 70, 0.04);
}

.ps-btn-light {
    background: #FC8F8F;
    color: #64242F;
}

.ps-btn-light:hover {
    background: #f57a7a;
}

.ps-btn-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1.5px solid #fecaca;
}

.ps-btn-danger:hover {
    background: #fee2e2;
    border-color: #f87171;
}

.ps-btn-ghost {
    background: transparent;
    color: #64242F;
    padding: 0.5rem 0.75rem;
}

.ps-btn-ghost:hover {
    background: rgba(100, 36, 47, 0.05);
}

.ps-btn-full {
    width: 100%;
}

.ps-btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.ps-btn-lg {
    padding: 1rem 2rem;
    font-size: 1.0625rem;
}


/* ── Loading spinner (add .is-loading to a button) ──────────── */

.ps-btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.ps-btn.is-loading::after {
    content: '';
    position: absolute;
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: ps-spin 0.6s linear infinite;
}

.ps-btn-primary.is-loading::after {
    border-color: rgba(255,255,255,0.4);
    border-right-color: transparent;
}

@keyframes ps-spin {
    to { transform: rotate(360deg); }
}


/* ── Auth Pages ─────────────────────────────────────────────── */

.auth-wrapper {
    min-height: calc(100vh - 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 26rem;
    animation: fadeUp 0.35s ease-out;
}

.auth-panel {
    background: #fff;
    border-radius: 1.25rem;
    padding: 2.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(223, 217, 216, 0.5);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ── Links ──────────────────────────────────────────────────── */

.ps-link {
    color: #B44446;
    text-decoration: none;
    font-weight: 700;
    transition: color 0.15s ease;
}

.ps-link:hover {
    color: #64242F;
}


/* ── Flash Messages ─────────────────────────────────────────── */

.flash-msg {
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    animation: slideDown 0.25s ease-out;
}

.flash-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.flash-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.flash-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.flash-info {
    background: #f9f7f7;
    border: 1px solid #DFD9D8;
    color: #64242F;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ── Divider ────────────────────────────────────────────────── */

.ps-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #a89e9c;
    font-size: 0.8125rem;
    margin: 1.5rem 0;
}

.ps-divider::before,
.ps-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #DFD9D8;
}


/* ── Badges ─────────────────────────────────────────────────── */

.ps-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 9999px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.ps-badge-brand {
    background: #fef5f5;
    color: #B44446;
}

.ps-badge-success {
    background: #f0fdf4;
    color: #166534;
}

.ps-badge-warning {
    background: #fffbeb;
    color: #92400e;
}

.ps-badge-neutral {
    background: #f3f0ef;
    color: #8d8381;
}


/* ── Cards (generic) ────────────────────────────────────────── */

.ps-card {
    background: #fff;
    border: 1px solid rgba(223, 217, 216, 0.6);
    border-radius: 1.25rem;
    padding: 1.5rem;
}

.ps-card-hover {
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.ps-card-hover:hover {
    border-color: #FC8F8F;
    box-shadow: 0 8px 24px rgba(180, 68, 70, 0.08);
    transform: translateY(-2px);
}


/* ── Homepage ───────────────────────────────────────────────── */

.hero-section {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #64242F 0%, #B44446 100%);
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to top, #f9f7f7, transparent);
}

.feature-card {
    background: #fff;
    border: 1px solid rgba(223, 217, 216, 0.6);
    border-radius: 1rem;
    padding: 2rem;
    transition: all 0.25s ease;
}

.feature-card:hover {
    border-color: #FC8F8F;
    box-shadow: 0 8px 24px rgba(180, 68, 70, 0.08);
    transform: translateY(-2px);
}

.step-number {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #FC8F8F;
    color: #64242F;
    font-weight: 700;
    font-size: 0.9375rem;
    flex-shrink: 0;
}


/* ── Empty States ───────────────────────────────────────────── */

.ps-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #a89e9c;
}

.ps-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    background: #f3f0ef;
    color: #c4bcba;
    margin-bottom: 1rem;
}


/* ── Tooltips (title-based, CSS-only) ───────────────────────── */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    padding: 0.375rem 0.625rem;
    background: #3d161c;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 0.5rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 50;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}


/* ── Print ──────────────────────────────────────────────────── */

@media print {
    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 11pt;
    }

    nav,
    .flash-msg,
    footer,
    .ps-btn,
    .skip-link,
    [x-cloak] {
        display: none !important;
    }

    main {
        padding: 0 !important;
    }

    a {
        color: inherit !important;
        text-decoration: none !important;
    }

    .ps-card,
    .feature-card,
    .auth-panel {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }

    h1, h2, h3 {
        break-after: avoid;
    }

    img {
        max-width: 100% !important;
        break-inside: avoid;
    }
}


/* ── Reduced Motion ─────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}


/* ── Mobile Tweaks ──────────────────────────────────────────── */

@media (max-width: 640px) {
    .auth-panel {
        padding: 1.75rem;
        border-radius: 1rem;
    }
}