/* ===== VARIABLES GLOBALES ===== */
:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --light: #f8f9fa;
    --dark: #343a40;
    --gray: #6c757d;
    --border: #e0e0e0;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.container {
    background: white;
    border-radius: 30px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 1300px;
    min-height: 700px;
    overflow: hidden;
    display: flex;
    position: relative;
    transition: all 0.3s ease;
}

/* ===== PANEL IZQUIERDO ===== */
.info-panel {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 50px;
    width: 40%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.info-panel::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.feature-list {
    list-style: none;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.feature-list li {
    margin: 20px 0;
    display: flex;
    align-items: center;
    font-size: 1.1em;
    animation: slideIn 0.5s ease-out;
    animation-fill-mode: both;
}

.feature-list li:nth-child(1) {
    animation-delay: 0.1s;
}

.feature-list li:nth-child(2) {
    animation-delay: 0.2s;
}

.feature-list li:nth-child(3) {
    animation-delay: 0.3s;
}

.feature-list li:nth-child(4) {
    animation-delay: 0.4s;
}

.feature-list li:nth-child(5) {
    animation-delay: 0.5s;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

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

.feature-list li:before {
    content: "✓";
    background: rgba(255, 255, 255, 0.2);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-weight: bold;
    font-size: 1.2em;
    transition: all 0.3s;
}

.feature-list li:hover:before {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.info-panel h1 {
    font-size: 3.5em;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.6s ease-out;
}

.info-panel p {
    font-size: 1.1em;
    line-height: 1.6;
    opacity: 0.9;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 30px;
    margin-top: 20px;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

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

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

/* ===== PANEL DERECHO ===== */
.main-panel {
    width: 60%;
    padding: 40px;
    background: white;
    overflow-y: auto;
    max-height: 800px;
    position: relative;
}

/* ===== SCROLL PERSONALIZADO ===== */
.main-panel::-webkit-scrollbar {
    width: 8px;
}

.main-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.main-panel::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.main-panel::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ===== TABS DE AUTENTICACIÓN ===== */
.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    font-size: 1.1em;
    cursor: pointer;
    color: #666;
    transition: all 0.3s;
    border-radius: 8px 8px 0 0;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    font-weight: bold;
}

/* ===== FORMULARIOS ===== */
.auth-form {
    display: none;
    flex-direction: column;
    align-items: center;
}

.auth-form.active {
    display: flex;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.auth-form .logo {
    max-width: 180px;
    width: 100%;
    height: auto;
    margin-bottom: 25px;
    display: block;
}

input,
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    margin: 8px 0;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1em;
    transition: all 0.3s;
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--primary);
}

/* ===== BOTONES ===== */
button {
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    font-weight: 600;
    margin: 5px 0;
    position: relative;
    overflow: hidden;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

button.small {
    padding: 8px 16px;
    font-size: 0.9em;
    width: auto;
}

button.mini {
    padding: 6px 10px;
    font-size: 1.2em;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

button.secondary {
    background: var(--light);
    color: var(--dark);
    border: 1px solid var(--border);
}

button.secondary:hover {
    background: #e9ecef;
    box-shadow: none;
    transform: translateY(-1px);
}

button.success {
    background: var(--success);
}

button.warning {
    background: var(--warning);
    color: var(--dark);
}

button.danger {
    background: var(--danger);
}

/* ===== ENLACES LEGALES ===== */
.legal-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    font-size: 0.9em;
    width: 100%;
}

.legal-links a {
    color: var(--gray);
    text-decoration: none;
    transition: color 0.3s;
}

.legal-links a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ===== APP SECTION ===== */
.app-section {
    display: none;
}

.app-section.active {
    display: block;
}

/* ===== HEADER CON HAMBURGUESA INTEGRADA ===== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-email {
    color: var(--primary);
    font-weight: 600;
    font-size: 1.1em;
    background: var(--light);
    padding: 8px 15px;
    border-radius: 30px;
    border: 1px solid var(--border);
}

/* ===== MENÚ HAMBURGUESA MEJORADO (SOLO MÓVIL) ===== */
.mobile-menu-toggle {
    display: none;
    /* Oculto por defecto en escritorio */
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 12px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
    transition: all 0.3s;
}

.mobile-menu-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.4);
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 3px;
    background: white;
    margin: 3px 0;
    border-radius: 3px;
    transition: all 0.3s;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ===== TABS PRINCIPALES ===== */
.app-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.app-tab {
    flex: 1 1 auto;
    min-width: 100px;
    padding: 12px 16px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 15px;
    cursor: pointer;
    text-align: center;
    color: var(--dark);
    font-weight: 500;
    transition: all 0.3s;
    font-size: 0.9em;
    white-space: nowrap;
}

.app-tab:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.app-tab.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.app-tab-content {
    display: none;
}

.app-tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

/* ===== TARJETAS ===== */
.card {
    background: rgba(131, 53, 233, 0.466);
    border-radius: 16px;
    padding: 20px;
    margin: 12px 0;
    border: 1px solid #edf2f7;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    transition: all 0.2s;
}

.card .card {
    background: rgb(255, 255, 255);
    border-radius: 16px;
    padding: 20px;
    margin: 12px 0;
    border: 1px solid #edf2f7;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    transition: all 0.2s;
}

.card .card:hover {
    border-color: var(--primary);
    box-shadow: 0 0px 15px 15px rgba(164, 6, 238, 0.363);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-title {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--dark);
}

.badge {
    background: var(--light);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75em;
    color: var(--gray);
    border: 1px solid var(--border);
}

.price {
    color: var(--success);
    font-weight: 600;
    font-size: 1.1em;
}

.fecha {
    color: var(--gray);
    font-size: 0.85em;
    margin-top: 5px;
}

/* ===== BOTONES DE ACCIÓN EN CARDS ===== */
.card .flex {
    gap: 6px;
    justify-content: flex-end;
    margin-top: 12px;
}

.card button.small {
    padding: 6px 12px;
    font-size: 0.8em;
    min-width: 60px;
    background: rgba(66, 167, 250, 0.479);
    color: var(--dark);
    border: 1px solid var(--border);
    box-shadow: none;
}

.card button.small.warning {
    color: #f59e0b;
    border-color: #f59e0b;
    background: #f5d20b41;
}

.card button.small.danger {
    color: #ef4444;
    border-color: #ef4444;
    background: #f50b0b33;
}

.card button.small:hover {
    background: var(--light);
    transform: none;
    box-shadow: none;
}

.card button.small.warning:hover {
    background: #f59e0b;
    color: white;
}

.card button.small.danger:hover {
    background: #ef4444;
    color: white;
}

/* ===== PRODUCTOS EN LISTA ===== */
.producto-lista {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 15px;
    border-radius: 15px;
    margin: 8px 0;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.producto-lista:hover {
    border-color: var(--primary);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.1);
}

.producto-lista-info {
    flex: 2;
}

.producto-lista-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.producto-lista input {
    width: 60px;
    margin: 0;
    text-align: center;
}

/* ===== VISTA PREVIA LISTA ===== */
.lista-actual {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    border: 2px dashed var(--primary);
}

.total {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--success);
    text-align: right;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid rgba(102, 126, 234, 0.2);
}

/* ===== CHECKBOXES PERSONALIZADOS ===== */
.checkbox-wrapper {
    display: inline-block;
    position: relative;
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.checkbox-label {
    display: inline-block;
    width: 24px;
    height: 24px;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.checkbox-wrapper input[type="checkbox"]:checked+.checkbox-label {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-wrapper input[type="checkbox"]:checked+.checkbox-label::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
}

.checkbox-wrapper:hover .checkbox-label {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

/* ===== TEXTO TACHADO ===== */
.tachado {
    text-decoration: line-through;
    color: var(--gray) !important;
    opacity: 0.7;
}

/* ===== ESTILO PARA LISTA DE PRODUCTOS - VERSIÓN CORREGIDA ===== */
.lista-producto-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 10px;
    margin: 5px;
    border-radius: 5ch;
    width: 100%;
    background-color: #aa5ad848;
}

.lista-producto-item:hover {
    background-color: #aa5ad848;
}

.lista-producto-checkbox {
    flex: 0 0 24px;
}

.lista-producto-cantidad {
    background: var(--primary);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    white-space: nowrap;
}

.lista-producto-subtotal-wrapper {
    margin-left: auto;
    /* Esto empuja todo el wrapper a la derecha */
    flex: 0 1 auto;
    display: flex;
    justify-content: flex-end;
    /* Alinea el contenido a la derecha dentro del wrapper */
    min-width: fit-content;
}

.lista-producto-nombre {
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lista-producto-notas {
    color: var(--gray);
    font-size: 0.8em;
    font-style: italic;
    margin-left: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.lista-producto-subtotal {
    color: var(--success);
    font-weight: bold;
    font-size: 1em;
    white-space: nowrap;
    background-color: #fffb00;
    border-radius: 10ch;
    padding: 4px 12px;
    margin-left: 8px;
    flex: 0 1 auto;
    min-width: fit-content;
    max-width: fit-content;
    /* CAMBIO IMPORTANTE: limita el ancho al contenido */
    width: fit-content;
    /* Para navegadores que lo soportan */
    display: inline-block;
    /* Asegura que se comporte como inline-block */
}

/* Contenedor flexible para nombre y notas */
.lista-producto-info {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* ===== MODALES ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgb(229, 206, 245);
    border-radius: 30px;
    padding: 35px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

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

.close {
    float: right;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray);
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close:hover {
    color: var(--dark);
    background: var(--light);
    transform: rotate(90deg);
}

/* ===== UTILIDADES ===== */
.flex {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

.text-center {
    text-align: center;
}

/* ===== MENSAJES ===== */
.message {
    padding: 15px 20px;
    border-radius: 15px;
    margin: 20px 0;
    display: none;
    animation: slideDown 0.3s ease-out;
    font-weight: 500;
}

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

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

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== RESPONSIVE MÓVIL ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        flex-direction: column;
        border-radius: 20px;
    }

    .info-panel {
        width: 100%;
        padding: 30px 20px;
    }

    .info-panel h1 {
        font-size: 2.5em;
    }

    .feature-list li {
        font-size: 1em;
    }

    .main-panel {
        width: 100%;
        padding: 25px;
        max-height: none;
    }

    /* Hamburguesa visible SOLO en móvil */
    .mobile-menu-toggle {
        display: flex;
        width: 40px;
        height: 40px;
    }

    .mobile-menu-toggle span {
        width: 20px;
        height: 2.5px;
    }

    .app-header {
        padding-left: 0;
        padding-right: 10px;
    }

    .header-left {
        gap: 10px;
    }

    .user-email {
        font-size: 0.9em;
        padding: 6px 12px;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-tabs {
        display: none;
        position: static;
        top: 140px;
        left: 20px;
        right: 20px;
        background: white;
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
        padding: 15px;
        flex-direction: column;
        z-index: 99;
    }

    .app-tabs.active {
        display: flex;
    }

    .app-tab {
        width: 100%;
        text-align: left;
        padding: 15px;
        margin: 3px 0;
        border-radius: 12px;
    }

    .lista-producto-item {
        gap: 8px;
    }

    .lista-producto-cantidad {
        width: 28px;
        height: 28px;
        font-size: 0.8em;
    }

    .lista-producto-info {
        flex-wrap: wrap;
    }

    .lista-producto-notas {
        max-width: 100px;
        font-size: 0.75em;
    }

    .producto-lista {
        flex-direction: column;
        text-align: center;
    }

    .producto-lista-controls {
        width: 100%;
        justify-content: center;
    }

    .modal-content {
        padding: 25px;
    }

    .legal-links {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}

/* ===== MÓVILES MUY PEQUEÑOS ===== */
@media (max-width: 480px) {
    .lista-producto-item {
        flex-wrap: wrap;
    }

    .lista-producto-info {
        flex: 1 1 100%;
        order: 2;
        margin-left: 34px;
    }

    .lista-producto-subtotal {
        order: 3;
        margin-left: 34px;
        width: 100%;
        text-align: right;
    }
}

@media (max-width: 340px) {
    .lista-producto-cantidad {
        width: 24px;
        height: 24px;
        font-size: 0.7em;
    }
}
