:root {
    /* ── Paleta Ovidio ────────────────────────────────────
       Verde petróleo  #0E6B68
       Carbón          #202428
       Dorado cálido   #D7A84A
       Niebla suave    #F3F7F6
       Blanco          #FFFFFF
    */

    /* Modo Light (Default) */
    --primary: #0E6B68;
    --primary-dark: #084543;
    --accent: #D7A84A;
    --warning: #D7A84A;

    --bg-dark: #F3F7F6;
    --card-bg: #FFFFFF;
    --input-bg: #FFFFFF;

    --text-primary: #202428;
    --text-secondary: #5C6873;
    --border: #DCE5E3;

    --radius-lg: 24px;
    --radius-md: 12px;
}

[data-theme="dark"] {
    /* Modo Dark */
    --primary: #1A9591;
    --primary-dark: #0E6B68;
    --accent: #D7A84A;

    --bg-dark: #161A1D;
    --card-bg: #202428;
    --input-bg: #2A2F33;

    --text-primary: #F3F7F6;
    --text-secondary: #A8B0B5;
    --border: #353B40;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, sans-serif;
}

body {
    background-color: var(--bg-dark);
    min-height: 100vh;
    color: var(--text-primary);
    padding: 2rem;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.header-card {
    padding: 1.5rem 2.5rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.user-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.user-greeting { color: var(--text-secondary); }
.user-greeting strong { color: var(--text-primary); }

.user-bar-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--primary);
    border-radius: 6px;
    transition: background 0.15s;
}
.user-bar-link:hover { background: rgba(14,107,104,0.1); }

.user-bar-logout {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.65rem;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.user-bar-logout:hover { color: #ef4444; border-color: #ef4444; }

.logo-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-image {
    width: 65px;
    height: 65px;
    object-fit: contain;
}

.logo-group h1 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--primary);
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.theme-btn {
    background: transparent;
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary);
    border-color: var(--primary);
}

.main-card {
    padding: 2.5rem;
}

.footer-card {
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-image {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.card-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.card-header h2 {
    font-size: 1.8rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.form-section {
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
    fill: rgba(215, 168, 74, 0.2);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-sm {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

input,
select {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    width: 100%;
    outline: none;
    transition: all 0.2s;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(14, 107, 104, 0.2);
}

.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-suffix span {
    position: absolute;
    right: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    pointer-events: none;
}

.custom-select-container {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.custom-select-container.disabled {
    opacity: 0.5;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.2);
}

.option-item {
    padding: 12px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    color: var(--text-primary);
    border: 1px solid transparent;
}

.option-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.option-item.selected {
    background-color: var(--primary);
    color: white;
    border-color: rgba(255, 255, 255, 0.1);
    font-weight: 500;
}

.option-item.selected::after {
    content: "✓";
    font-size: 1.1em;
}

.multiselect-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.2rem;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
    margin-left: auto;
    margin-bottom: 0.35rem;
}

.multiselect-clear svg {
    width: 15px;
    height: 15px;
}

.multiselect-clear:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.empty-message {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.9rem;
}

.hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 2.5rem 0;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 3rem;
}

.btn {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s;
    border: none;
}

.btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(17, 119, 183, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-primary);
}

.product-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    background: rgba(17, 119, 183, 0.05);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    transition: all 0.3s;
    margin-top: 0.5rem;
}

.hidden { display: none !important; }

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(17, 119, 183, 0.5); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(17, 119, 183, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(17, 119, 183, 0); }
}

.generating-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: var(--primary);
    background: rgba(17, 119, 183, 0.1);
    padding: 1rem;
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0.5rem;
    font-weight: 600;
    border: 1px solid rgba(17, 119, 183, 0.2);
}

.spinner-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse-loading 1s infinite ease-in-out;
}

@keyframes pulse-loading {
    0%, 100% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: 0.2s;
    z-index: 100;
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 32px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-icon {
    width: 72px; height: 72px;
    background: rgba(17, 119, 183, 0.1);
    color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 2rem;
    display: flex; align-items: center; justify-content: center;
}

.modal-icon.warning {
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning);
}

.modal-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.toast {
    position: fixed;
    bottom: 2rem; right: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 1.25rem;
    border-radius: 16px;
    transform: translateX(180%);
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 200;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.toast.show { transform: translateX(0); }
.toast.error { border-left: 6px solid #ef4444; }

/* Utilities */
.mt-4 { margin-top: 2rem; }
.mt-6 { margin-top: 3rem; }
.mb-4 { margin-bottom: 2rem; }

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.02);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* ═══════ Responsive Catálogo ═══════ */

/* Tablet */
@media (max-width: 900px) {
    body { padding: 1.25rem; }
    .header-card { padding: 1.25rem 1.5rem; }
    .main-card { padding: 1.75rem; }
    .logo-image { width: 52px; height: 52px; }
    .logo-group h1 { font-size: 1.25rem; }
    .card-header { margin-bottom: 1.75rem; }
}

/* Mobile */
@media (max-width: 640px) {
    body { padding: 0.75rem; }
    .container { gap: 1rem; }

    /* Header card */
    .header-card { padding: 1rem 1.25rem; border-radius: 18px; }
    .header-content {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .logo-image { width: 44px; height: 44px; }
    .logo-group { gap: 0.65rem; }
    .logo-group h1 { font-size: 1.1rem; }
    .subtitle { font-size: 0.78rem; }
    .theme-btn { width: 34px; height: 34px; }
    .theme-btn svg { width: 16px; height: 16px; }

    /* User bar pasa abajo en mobile, ocupa todo el ancho */
    .user-bar {
        order: 3;
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
        font-size: 0.78rem;
        padding-top: 0.6rem;
        border-top: 1px solid var(--border);
        margin-top: 0.2rem;
    }
    .user-bar-link, .user-bar-logout {
        padding: 0.35rem 0.7rem;
        font-size: 0.78rem;
    }

    /* Main card */
    .main-card { padding: 1.25rem 1rem; border-radius: 18px; }
    .card-header { margin-bottom: 1.5rem; }
    .card-header h2 { font-size: 1.25rem; }

    /* Sections */
    .form-section { margin-bottom: 0.5rem; }
    .section-title { font-size: 0.95rem; gap: 0.5rem; }
    .section-title svg { width: 18px; height: 18px; }

    /* Grids → single column */
    .grid-2 { grid-template-columns: 1fr; gap: 1rem; }

    /* Inputs */
    input, select {
        font-size: 16px !important; /* evita zoom en iOS */
        padding: 0.7rem 0.85rem;
    }
    .input-with-suffix input { font-size: 16px !important; }

    /* Multi-select container */
    .custom-select-container { height: 160px; padding: 0.4rem; }
    .option-item { padding: 10px 12px; font-size: 0.9rem; }

    /* Form actions */
    .form-actions { gap: 0.6rem; margin-top: 1.25rem; }
    .btn { padding: 0.75rem 1rem; font-size: 0.9rem; }
    .btn svg { width: 16px; height: 16px; }

    /* Modal */
    .modal {
        padding: 1.5rem 1.25rem;
        border-radius: 18px;
        max-width: calc(100vw - 1.5rem);
    }
    .modal-icon { width: 56px; height: 56px; }
    .modal-icon svg { width: 28px; height: 28px; }
    .modal h3 { font-size: 1.15rem; }
    .modal p { font-size: 0.88rem; }
    .modal-actions {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }
    .modal-actions .btn { width: 100%; }

    /* Online link modal — input + button stack on small */
    #onlineLinkInput {
        font-size: 0.78rem !important;
        padding: 0.55rem !important;
    }

    /* Counter pill */
    .product-counter, .generating-pill {
        font-size: 0.82rem;
        padding: 0.55rem 0.9rem;
    }

    /* Footer image scaling */
    .footer-card { padding: 1rem; }

    /* Toast — ocupa todo el ancho en mobile */
    .toast {
        right: 0.75rem;
        left: 0.75rem;
        bottom: 0.75rem;
        padding: 0.85rem 1rem;
        transform: translateY(160%);
    }
    .toast.show { transform: translateY(0); }
}

/* Small phones */
@media (max-width: 380px) {
    .header-content { gap: 0.5rem; }
    .logo-image { width: 38px; height: 38px; }
    .logo-group h1 { font-size: 1rem; }
    .main-card { padding: 1rem 0.85rem; }
    .card-header h2 { font-size: 1.1rem; }
    .subtitle { font-size: 0.75rem; }
}