@import url('https://fonts.googleapis.com/css2?family=Megrim&family=Poppins:wght@300;400;500;700&display=swap');

:root {
    /* ── Core Palette (DESIGN.md §2) ── */
    --color-core: #050505;
    --color-surface-elevated: #1A1A1A;
    --color-primary: #FFFFFF;
    --color-subtle: #A1A1A1;
    --color-border-subtle: rgba(255, 255, 255, 0.05);
    --color-border-medium: rgba(255, 255, 255, 0.10);
    --color-border-emphasis: rgba(255, 255, 255, 0.30);
    --color-error: #E53E3E;

    /* ── Semantic Aliases (backward-compat for inline styles in HTML/JS) ── */
    --bg-color: var(--color-core);
    --surface-color: var(--color-surface-elevated);
    --surface-border: var(--color-border-medium);
    --text-primary: var(--color-primary);
    --text-secondary: var(--color-subtle);
    --text-muted: #666666;
    --accent-color: var(--color-primary);
    --success-color: #4ade80;
    --error-color: var(--color-error);

    /* ── Typography ── */
    --font-heading: 'Megrim', cursive;
    --font-body: 'Poppins', sans-serif;

    /* ── Spacing & Shape ── */
    --border-radius: 0.125rem;
    /* 2px – geometric sharpness */
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Global Outline Overrides (DESIGN.md §4 — Global Outline Overrides) ── */
button:focus,
[role="button"]:focus,
input:focus,
textarea:focus,
select:focus,
a:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ══════════════════════════════════════
   BODY & LAYOUT
   ══════════════════════════════════════ */
body {
    background-color: var(--color-core);
    color: var(--color-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    line-height: 1.6;

    display: flex;
    flex-direction: column;

    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ── Amani Glow Orbs (DESIGN.md §1.3 — Organic Atmosphere) ── */
.amani-glow {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    animation: amaniBreath 8s ease-in-out infinite;
}

.amani-glow--primary {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
    filter: blur(100px);
    top: 10%;
    left: -10%;
    animation-delay: 0s;
}

.amani-glow--secondary {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.025) 0%, transparent 70%);
    filter: blur(120px);
    bottom: 15%;
    right: -8%;
    animation-delay: 4s;
}

.amani-glow--accent {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(74, 222, 128, 0.02) 0%, transparent 70%);
    filter: blur(110px);
    top: 50%;
    left: 30%;
    transform: translate(-50%, -50%);
    animation-delay: 2s;
}

@keyframes amaniBreath {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.08);
    }
}

/* ── Layout Container ── */
.container {
    position: relative;
    z-index: 1;

    display: flex;
    align-items: flex-start;
    align-content: center;
    justify-content: center;
    flex-direction: column;

    margin: 0 auto;
    padding: 2rem 1.5rem;

    width: 100%;
    max-width: 800px;
    min-width: 200px;

    header {
        display: flex;
        align-items: flex-start;
        justify-content: center;
        flex-direction: column;

        margin-bottom: 3rem;
        animation: fadeInDown 0.8s ease;

        .logo.main {
            color: var(--color-primary);
            font-family: var(--font-heading);
            font-size: 1.5rem;
            font-weight: 550;
            letter-spacing: 0.05em;
            text-transform: uppercase;

            margin-bottom: 1rem;
        }

        h1 {
            font-family: var(--font-body);
            font-size: 1rem;
            font-weight: 500;
            line-height: 1.1;

            margin-bottom: 2px;
        }

        .meta-info {
            color: var(--color-subtle);
            font-size: 0.82rem;
            font-family: var(--font-body);

            display: flex;
            justify-content: center;
            flex-direction: column;
            gap: 2px;

            flex-wrap: wrap;
        }
    }

    /* ── Cards — Glassmorphism (DESIGN.md §4 — Cards) ── */
    .card {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--color-border-medium);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        border-radius: var(--border-radius);
        padding: 1.5rem;

        margin-bottom: 1.5rem;

        animation: fadeInUp 0.8s ease both;

        width: 100%;

        transition: border-color 0.3s ease, background-color 0.3s ease;

        .title {
            border-bottom: 1px solid var(--color-border-subtle);
            color: var(--color-primary);

            font-family: var(--font-body);
            font-size: 1rem;
            font-weight: 500;
            line-height: 1.2;

            display: flex;
            align-items: center;


            width: inherit;
        }

        .info {
            color: var(--color-subtle);
            font-size: 0.85rem;
            line-height: 1.6;
        }

        .phases-grouped {
            display: flex;
            align-items: flex-start;
            flex-direction: column;

            list-style: none;

            padding-left: 7px;

            .deliverable-item {
                color: var(--color-subtle);

                font-size: 0.85rem;
                line-height: 1.6;

                display: flex;
                align-items: flex-start;

                gap: 7px;

                .bullet {
                    font-size: 1.2rem;
                    height: 1.35rem;
                    display: flex;
                    align-items: center;
                    justify-content: center;

                    gap: 2px;
                }
            }
        }

        .terms-list-grouped {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 14px;

            margin-bottom: 1rem;

            animation: fadeInUp 0.8s ease both;

            /* ── Terms Groups ── */
            .terms-group {
                .terms-category {
                    color: var(--color-primary);
                    font-family: var(--font-body);
                    font-size: 0.9rem;
                    font-weight: 500;

                    margin-bottom: 1px;
                }

                .terms-category-list {
                    display: flex;
                    align-items: flex-start;
                    flex-direction: column;

                    list-style: none;
                    padding-left: 7px;

                    .deliverable-item {
                        color: var(--color-subtle);

                        font-size: 0.85rem;
                        line-height: 1.6;

                        display: flex;
                        align-items: flex-start;

                        gap: 7px;

                        .bullet {
                            font-size: 1.2rem;
                            height: 1.35rem;
                            display: flex;
                            align-items: center;
                            justify-content: center;

                            gap: 2px;
                        }
                    }
                }
            }
        }

        .timeline {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 14px;


        }

        /* ── Payment Options ── */
        .payment-option {
            border: 1px solid var(--color-border-medium);
            border-radius: var(--border-radius);
            background: rgba(255, 255, 255, 0.03);
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);

            padding: 1.5rem;

            display: flex;
            align-items: flex-start;

            position: relative;
            overflow: hidden;

            margin-bottom: 7px;
            cursor: pointer;
            transition: var(--transition);

            width: inherit;

            .payment-option-content {
                flex: 1;

                .payment-option-title {
                    font-weight: 500;
                    font-size: 0.95rem;

                    display: flex;
                    justify-content: space-between;

                    margin-bottom: 7px;

                    .currency {
                        color: var(--text-primary);
                        font-weight: 400;
                    }

                    @media (max-width: 600px) {
                        flex-direction: column;
                        align-items: flex-start;
                        gap: 7px;
                    }
                }

                .payment-option-desc {
                    color: var(--color-subtle);
                    font-size: 0.85rem;

                    margin-bottom: 2px;
                }

                .payment-option-breakdown {
                    color: var(--text-muted);
                    font-size: 0.82rem;
                }
            }
        }

        .payment-option:hover {
            border-color: var(--color-border-emphasis);
            background: rgba(255, 255, 255, 0.05);
        }

        .payment-option.selected {
            border-color: var(--color-primary);
            background: rgba(255, 255, 255, 0.07);
        }
    }

    .card:hover {
        border-color: var(--color-border-emphasis);
    }

    /* Cascading entrance delays */
    .card:nth-child(1) {
        animation-delay: 0.1s;
    }

    .card:nth-child(2) {
        animation-delay: 0.15s;
    }

    .card:nth-child(3) {
        animation-delay: 0.2s;
    }

    .card:nth-child(4) {
        animation-delay: 0.25s;
    }

    .card:nth-child(5) {
        animation-delay: 0.3s;
    }

    .card:nth-child(6) {
        animation-delay: 0.35s;
    }

    .card:nth-child(7) {
        animation-delay: 0.4s;
    }

    .card:nth-child(8) {
        animation-delay: 0.45s;
    }

    .card:nth-child(9) {
        animation-delay: 0.5s;
    }

    .card:nth-child(10) {
        animation-delay: 0.55s;
    }

    .value-table {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 7px;

        margin-bottom: 1rem;

        animation: fadeInUp 0.8s ease both;
    }

    .timeline {
        margin-bottom: 1rem;

        animation: fadeInUp 0.8s ease both;
    }

    /* ── Footer ── */
    footer {
        border-top: 1px solid var(--color-border-medium);

        color: var(--text-muted);
        font-size: 0.8rem;

        display: flex;
        align-items: center;
        justify-content: center;

        margin-top: 3rem;
        padding-top: 2rem;

        width: inherit;
        height: fit-content;
    }
}

/* ══════════════════════════════════════
   LOGO (Global — loading/error states)
   ══════════════════════════════════════ */
.logo {
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 500;

    text-transform: uppercase;

    margin-bottom: 7px;
}

/* ── Loading State ── */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;

    animation: fadeIn 1s ease-in-out;

    min-height: 90vh;
}

/* ══════════════════════════════════════
   TYPOGRAPHY — DESIGN.MD §2
   ══════════════════════════════════════ */
h2 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 500;
    line-height: 1.2;

    margin-bottom: 7px;

    color: var(--color-primary);
    border-bottom: 1px solid var(--color-border-subtle);
    padding-bottom: 7px;
}

h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.05em;

    margin-bottom: 1rem;
}

/* ══════════════════════════════════════
   VALUE TABLE
   ══════════════════════════════════════ */
.value-table {
    width: 100%;
    border-collapse: collapse;
}

.value-table th,
.value-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border-subtle);
    font-size: 0.85rem;
}

.value-table th {
    color: var(--color-subtle);
    font-weight: 500;
    font-size: 0.82rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.value-table tr:last-child td {
    border-bottom: none;
}

/* ══════════════════════════════════════
   TIMELINE
   ══════════════════════════════════════ */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.45rem;
    top: 0.5rem;
    bottom: 0;
    width: 2px;
    background: var(--color-border-medium);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 0.4rem;
    width: 1rem;
    height: 1rem;
    background: var(--color-core);
    border: 2px solid var(--color-subtle);
    border-radius: 50%;
}

.timeline-date {
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.timeline-desc {
    color: var(--color-subtle);
    font-size: 0.85rem;
    line-height: 1.6;
}

/* ══════════════════════════════════════
   TERMS ACCEPTANCE
   ══════════════════════════════════════ */
.acceptance-area {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border-subtle);
}

.checkbox-wrapper {
    display: flex;
    align-items: flex-start;

    margin-bottom: 1.5rem;

    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    accent-color: var(--color-primary);
    border: 1px solid var(--color-border-medium);

    cursor: pointer;

    margin-top: 0.25rem;
    margin-right: 0.5rem;

    width: 1rem;
    height: 1rem;
}

/* ── Input Group (DESIGN.md §4 — Inputs & Form Controls) ── */
.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.input-group label {
    margin-bottom: 0.5rem;
    font-size: 0.82rem;
    letter-spacing: 0.05em;
    color: var(--color-subtle);

    display: flex;
    align-items: center;
    gap: 7px;
}

.input-group input[type="text"] {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border-medium);
    border-radius: var(--border-radius);

    color: var(--color-primary);
    padding: 0.75rem 1rem;

    font-family: var(--font-body);
    font-size: 0.82rem;
    transition: border-color 0.3s ease;
}

.input-group input[type="text"]::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.input-group input[type="text"]:focus {
    outline: none;
    box-shadow: none;
    border-color: var(--color-border-emphasis);
}

.input-group input[type="text"]:disabled {
    background: var(--color-border-subtle);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

/* ══════════════════════════════════════
   BUTTONS (DESIGN.md §4 — Buttons)
   ══════════════════════════════════════ */

/* Primary Action Button */
button {
    background: var(--color-primary);
    color: var(--color-core);
    border: 1px solid transparent;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

button:hover {
    background: #e0e0e0;
}

button:active {
    transform: scale(0.98);
}

/* Disabled State (DESIGN.md §4 — Disabled State) */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

button:disabled:hover {
    background: var(--color-primary);
    transform: none;
}

/* Pay Button (Success variant) */
.btn-pay {
    background: var(--success-color);
    color: #000;
}

.btn-pay:hover {
    background: #3ac76d;
}

/* ══════════════════════════════════════
   TOAST NOTIFICATION SYSTEM
   ══════════════════════════════════════ */
#toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid var(--color-border-medium);
    border-radius: var(--border-radius);
    color: var(--color-primary);
    font-size: 0.82rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 380px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-color: rgba(74, 222, 128, 0.3);
}

.toast.success svg {
    color: var(--success-color);
}

.toast.error {
    border-color: rgba(227, 62, 62, 0.3);
}

.toast.error svg {
    color: var(--color-error);
}

/* ══════════════════════════════════════
   SUCCESS STATE
   ══════════════════════════════════════ */
.success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(74, 222, 128, 0.1);
    color: var(--success-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    animation: successPulse 0.6s ease;
}

@keyframes successPulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ══════════════════════════════════════
   DOWNLOAD BUTTON (Outline/Secondary — DESIGN.md §4)
   ══════════════════════════════════════ */
.btn-download {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-border-medium);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: var(--transition);
}

.btn-download:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--color-border-emphasis);
}

.btn-download:active {
    transform: scale(0.98);
}

/* ══════════════════════════════════════
   PAYMENT SECURITY BADGES
   ══════════════════════════════════════ */
.payment-security-badges {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .payment-security-badges {
        flex-direction: column;
        gap: 0.25rem;
    }

    .payment-security-badges span:nth-child(2) {
        display: none;
    }

    #toast-container {
        top: auto;
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }

    .toast {
        max-width: 100%;
    }
}

/* ══════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════ */
.hidden {
    display: none !important;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ── Error/Empty States ── */
#error-state {
    text-align: center;
    padding: 4rem 2rem;
}

#error-message {
    color: var(--color-error);
    font-family: var(--font-body);
    font-size: 0.85rem;
}

/* ══════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */
@media (max-width: 600px) {
    .logo {
        font-size: 2.5rem;
    }

    .container header h1 {
        font-size: 1.4rem;
    }

    .container .card .title {
        font-size: 1.2rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    .value-table th,
    .value-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.82rem;
    }

    .amani-glow--primary {
        width: 300px;
        height: 300px;
    }

    .amani-glow--secondary {
        width: 250px;
        height: 250px;
    }

    .amani-glow--accent {
        width: 200px;
        height: 200px;
    }
}