/* Main App Layout */
.app-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    padding: 0;
    gap: 0;
    align-items: stretch;
    position: relative;
    height: 100vh;
    overflow: hidden;
}

/* Payment Module Grid */
.pago-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "header header"
        "main sidebar";
    height: 100vh;
    background: var(--bg-surface);
}

.pago-header {
    grid-area: header;
    background: white;
    padding: 15px 40px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pago-main-content {
    grid-area: main;
    overflow-y: auto;
    align-self: start;
}

#cart-container {
    grid-area: sidebar;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-left: 1px solid var(--border-light);
    background: white;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.05);
}

@media (max-width: 1024px) {
    .pago-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
}

:root {
    --primary: #4f46e5;
    --bg-gradient: linear-gradient(135deg, #4f46e5 0%, #1e1b4b 100%);
    --glass: rgba(255, 255, 255, 0.1);
    --surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-sidebar: rgba(255, 255, 255, 0.05);
    --radius-xl: 40px;
    --radius-lg: 32px;
    --radius-md: 18px;
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);

    /* Clarion Pro Vars */
    --clarion-indigo: #4338ca;
    --clarion-indigo-light: #6366f1;
    --clarion-gradient: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
    --clarion-surface: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    --clarion-bg: #f8fafc;
    --clarion-border: #e2e8f0;
    --clarion-text-main: #1e293b;
    --clarion-text-muted: #64748b;
    --clarion-glow: 0 10px 40px rgba(67, 56, 202, 0.15);
}

html,
body {
    background: var(--bg-gradient);
    margin: 0;
    height: 100vh;
    overflow: hidden;
    color: white;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 14px;
}

body {
    display: flex;
    width: 100vw;
}

#app {
    flex: 1;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.sidebar {
    width: 80px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(25px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transition: width var(--transition-smooth);
    display: flex;
    flex-direction: column;
    padding: 30px 15px;
    z-index: 1000;
}

.sidebar:hover {
    width: 240px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 15px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    border-radius: 16px;
    margin-bottom: 8px;
    white-space: nowrap;
    transition: 0.3s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-text {
    opacity: 0;
    transition: 0.3s;
    font-weight: 600;
    font-size: 0.95rem;
}

.sidebar:hover .nav-text {
    opacity: 1;
}

/* Wizard Shell */
.wizard-container {
    background: #ffffff;
    /* Original search area was white-ish surface */
    border-radius: var(--radius-xl);
    height: 90vh;
    color: var(--text-main);
    position: relative;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 95%;
    margin: 5vh auto;
}



.step-2-active .agency-portal {
    opacity: 1;
    transform: translateY(-50%);
    pointer-events: all;
}

.screens-wrapper {
    position: relative;
    flex: 1;
    overflow: hidden;
}

.screen {
    position: absolute;
    inset: 0;
    padding: 50px;
    transition: 0.7s cubic-bezier(0.85, 0, 0.15, 1);
    display: flex;
    flex-direction: column;
}

#screen-1 {
    transform: translateX(0);
}

#screen-2 {
    transform: translateX(100%);
}

.step-2-active #screen-1 {
    transform: translateX(-100%);
}

.step-2-active #screen-2 {
    transform: translateX(0);
}

/* --- CLARION PRO DESIGN (CHECKOUT) --- */

.full-page-checkout {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--clarion-bg);
    color: var(--clarion-text-main);
}

.checkout-navbar-pro {
    height: 70px;
    background: white;
    border-bottom: 1px solid var(--clarion-border);
    display: flex;
    align-items: center;
    padding: 0 40px;
    justify-content: space-between;
}

.steps-indicator-pro {
    display: flex;
    gap: 12px;
}

.step-pill {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--clarion-text-muted);
    background: #f1f5f9;
    border: 1px solid var(--clarion-border);
}

.step-pill.active {
    background: var(--clarion-gradient);
    color: white;
    border-color: transparent;
}

.step-pill.done {
    background: #e0e7ff;
    color: var(--clarion-indigo);
    border-color: var(--clarion-indigo);
}

.checkout-hero-pro {
    background: var(--clarion-gradient);
    padding: 16px 45px;
    /* REFINED: Reduced padding */
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-title-pro {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -1px;
    margin: 0;
}

.badge-tc-pro {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px 25px;
    border-radius: 20px;
    text-align: right;
}

.checkout-content-pro {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 450px;
    grid-template-rows: 1fr;
    /* Force rows to stay within flex-1 parent */
    overflow: hidden;
    min-height: 0;
    /* Important for flex child compression */
}

.checkout-main-area {
    overflow-y: auto;
    padding: 30px 40px;
}

/* Sidebar with Sticky Footer */
.checkout-sidebar-pro {
    background: white;
    border-left: 1px solid var(--clarion-border);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.side-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 35px;
    /* REFINED: More compact */
}

.side-footer-pro {
    padding: 20px 40px;
    /* REFINED: More compact */
    background: #f8fafc;
    border-top: 1px solid var(--clarion-border);
    flex-shrink: 0;
    /* Important: Persistent */
}

/* Common Components */
.invoice-card-pro {
    background: white;
    border: 1px solid var(--clarion-border);
    border-radius: 20px;
    padding: 14px 18px;
    /* REFINED: Reduced padding */
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    /* REFINED: Reduced margin */
    transition: 0.3s;
    color: var(--clarion-text-main);
    cursor: pointer;
}

.invoice-card-pro:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.invoice-card-pro.selected {
    background: #f5f3ff;
    border-color: var(--clarion-indigo);
}

.selection-check-pro {
    width: 24px;
    height: 24px;
    border: 2px solid var(--clarion-border);
    border-radius: 8px;
    position: relative;
    transition: 0.3s;
    flex-shrink: 0;
}

.selected .selection-check-pro {
    background: var(--clarion-indigo);
    border-color: var(--clarion-indigo);
}

.selected .selection-check-pro::after {
    content: "✓";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 900;
}

.amount-main-pro {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--clarion-text-main);
}

/* Smart Finder */
.smart-finder-pouch {
    background: white;
    border: 1px solid var(--clarion-border);
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 20px;
}

.smart-finder-textarea {
    width: 100%;
    height: 60px;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 15px;
    border: 1px solid transparent;
    font-family: inherit;
    resize: none;
    box-sizing: border-box;
}

.smart-finder-textarea:focus {
    background: white;
    border-color: var(--clarion-indigo);
    outline: none;
}

.sf-msg {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 800;
    margin-top: 5px;
}

.sf-msg.success {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #d1fae5;
}

.sf-msg.error {
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #ffe4e6;
}

.sf-missing-list {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 8px;
    font-weight: 700;
    line-height: 1.4;
}

/* Totals */
.total-label-pro {
    font-size: 0.7rem;
    font-weight: 900;
    color: var(--clarion-text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 5px;
    display: block;
}

.total-value-pro {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--clarion-text-main);
    letter-spacing: -1.5px;
    margin-bottom: 15px;
}

.btn-clarion-pro {
    width: 100%;
    background: var(--clarion-gradient);
    color: white;
    border: none;
    padding: 18px;
    border-radius: 15px;
    font-weight: 900;
    font-size: 1.1rem;
    cursor: pointer;
    transition: 0.3s;
}

.btn-clarion-pro:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(67, 56, 202, 0.3);
}

.btn-clarion-pro:disabled {
    opacity: 0.5;
    filter: grayscale(1);
    cursor: not-allowed;
}

/* Group Select Logic */
.group-select {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-radius: 15px;
    border: 1px solid var(--clarion-border);
    margin-bottom: 18px;
    transition: 0.3s;
    color: var(--clarion-text-main);
}

.group-select.selected {
    background: #f5f3ff;
    border-color: var(--clarion-indigo);
}

.group-select.selected .group-select-text {
    color: var(--clarion-indigo);
}

.retention-alert-pro {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fffbeb;
    color: #b45309;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 900;
    margin-top: 8px;
    border: 1px solid #fef3c7;
}

@media (max-width: 1100px) {
    .checkout-content-pro {
        grid-template-columns: 1fr;
    }

    .checkout-sidebar-pro {
        border-left: none;
        border-top: 1px solid var(--clarion-border);
    }
}

/* Success Screen */
:root {
    --success: #10b981;
}

.success-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.5s ease-out forwards;
}

/* Toast Clarion (Gmail Style) */
.toast-container-clarion {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-clarion {
    background: #323232;
    color: white;
    padding: 14px 24px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.3s cubic-bezier(0, 0, 0.2, 1) forwards;
    pointer-events: auto;
    min-width: 300px;
}

@keyframes toastSlideIn {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastFadeOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(20px);
        opacity: 0;
    }
}

.check-container {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse 2s infinite, scaleUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.check-container svg {
    width: 50px;
    fill: white;
    animation: checkIn 0.5s cubic-bezier(.65, 0, .45, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleUp {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes checkIn {
    from {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }

    to {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}