/* ============================================
   VARIABLES CSS - Colores PREMIER
   ============================================ */
:root {
    --color-primario: #d4a017;
    --color-primario-hover: #e8c236;
    --color-secundario: #4b4742;
    --color-fondo: #f4ecd8;
    --color-blanco: #ffffff;
    --color-texto: #333333;
    --color-texto-claro: #666666;
    --color-borde: #e0d7c4;
    --color-error: #dc3545;
    --color-exito: #28a745;
    --sombra: 0 2px 8px rgba(0, 0, 0, 0.1);
    --sombra-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    --transicion: all 0.3s ease;
}

/* ============================================
   RESET Y BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: var(--color-fondo);
    color: var(--color-texto);
    line-height: 1.6;
    overflow-x: hidden;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

button, label, .section-title, .subsection-title {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: linear-gradient(135deg, var(--color-secundario) 0%, #3a3530 100%);
    color: var(--color-blanco);
    padding: 1.5rem 2rem;
    box-shadow: var(--sombra);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-container {
    background: var(--color-blanco);
    padding: 0.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo {
    height: 40px;
    width: auto;
}

.header-text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.header-text p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.btn-back {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    color: var(--color-blanco);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: var(--transicion);
    background: rgba(255, 255, 255, 0.1);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   MAIN
   ============================================ */
.main {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.card {
    background: var(--color-blanco);
    border-radius: 12px;
    box-shadow: var(--sombra);
    padding: 2.5rem;
    border-top: 4px solid var(--color-primario);
}

/* ============================================
   SECCIONES DEL FORMULARIO - ⭐ MEJORADO
   ============================================ */
.form-section {
    margin-bottom: 3rem;
}

.form-section:last-of-type {
    margin-bottom: 2rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700; /* ⭐ NEGRITA */
    color: var(--color-primario);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--color-primario); /* ⭐ MÁS GRUESO */
    text-transform: uppercase; /* ⭐ MAYÚSCULAS */
    letter-spacing: 0.5px;
}

.section-title .icon {
    width: 28px;
    height: 28px;
    stroke-width: 2.5;
}

.subsection-title {
    font-size: 1.125rem;
    font-weight: 700; /* ⭐ NEGRITA */
    color: var(--color-texto);
    margin: 1.5rem 0 1rem;
    text-transform: uppercase;
}

/* ============================================
   CAMPOS DE FORMULARIO - ⭐ LABELS EN NEGRITA
   ============================================ */
.field {
    margin-bottom: 1.5rem;
}

.field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600; /* ⭐ NEGRITA */
    color: var(--color-texto);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="date"],
.field select,
.field textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--color-borde);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transicion);
    background: var(--color-blanco);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--color-primario);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.1);
}

.field input:read-only {
    background: #f8f9fa;
    cursor: not-allowed;
}

.field textarea {
    resize: vertical;
    min-height: 80px;
}

.field-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ============================================
   RADIO BUTTONS
   ============================================ */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--color-borde);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transicion);
}

.radio-item:hover {
    border-color: var(--color-primario);
    background: rgba(212, 160, 23, 0.05);
}

.radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.radio-item input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--color-primario);
}

/* ============================================
   COMBO PERSONALIZADO (DROPDOWNS)
   ============================================ */
.combo-wrapper {
    position: relative;
}

.combo-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-texto-claro);
    user-select: none;
}

.combo-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-blanco);
    border: 2px solid var(--color-primario);
    border-radius: 8px;
    margin-top: 0.25rem;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: var(--sombra-hover);
    z-index: 10;
}

.combo-list div {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transicion);
}

.combo-list div:hover {
    background: rgba(212, 160, 23, 0.1);
    color: var(--color-primario);
}

/* ============================================
   AUTOCOMPLETADO DIRECCIÓN
   ============================================ */
.address-wrapper {
    position: relative;
}

.suggestions-box {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-blanco);
    border: 2px solid var(--color-primario);
    border-radius: 8px;
    margin-top: 0.25rem;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: var(--sombra-hover);
    z-index: 10;
}

.suggestion-item {
    padding: 0.875rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--color-borde);
    transition: var(--transicion);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: rgba(212, 160, 23, 0.1);
    color: var(--color-primario);
}

/* ============================================
   CONSTRUCTOR DE PRODUCTOS
   ============================================ */
.product-builder {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 2px dashed var(--color-borde);
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.field-full {
    grid-column: 1 / -1;
}

/* ============================================
   TABLA DE PRODUCTOS
   ============================================ */
.tabla-responsive {
    overflow-x: auto;
    margin: 1.5rem 0;
}

.tabla-productos {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-blanco);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--sombra);
}

.tabla-productos thead {
    background: var(--color-primario);
    color: var(--color-texto);
}

.tabla-productos th,
.tabla-productos td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-borde);
}

.tabla-productos th {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tabla-productos tbody tr {
    transition: var(--transicion);
}

.tabla-productos tbody tr:hover {
    background: rgba(212, 160, 23, 0.05);
}

.btn-remove {
    background: var(--color-error);
    color: var(--color-blanco);
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transicion);
}

.btn-remove:hover {
    background: #c82333;
    transform: scale(1.05);
}

/* ============================================
   ⭐ TOTAL DEL PEDIDO - NUEVO DISEÑO
   ============================================ */
.field-total {
    margin-top: 2rem;
    background: linear-gradient(135deg, var(--color-primario) 0%, #c99516 100%);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(212, 160, 23, 0.25);
    border: 2px solid #e5b825;
}

.field-total label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-texto);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 0.75rem;
}

.field-total label::before {
    content: '💵 ';
    font-size: 1.3rem;
    margin-right: 0.5rem;
}

.field-total input {
    width: 100%;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-texto);
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #ffffff;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    text-align: right;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.08);
}

.field-total input:focus {
    transform: scale(1.01);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.08), 0 0 0 3px rgba(255,255,255,0.4);
}

/* ============================================
   ⭐ BOTONES - SEPARADOS Y SEGUROS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transicion);
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primario);
    color: var(--color-texto);
    box-shadow: 0 2px 8px rgba(212, 160, 23, 0.3);
}

.btn-primary:hover {
    background: var(--color-primario-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 160, 23, 0.4);
}

.btn-secondary {
    background: var(--color-secundario);
    color: var(--color-blanco);
    box-shadow: 0 2px 8px rgba(75, 71, 66, 0.3);
}

.btn-secondary:hover {
    background: #5c5751;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(75, 71, 66, 0.4);
}

.btn-add {
    width: 100%;
}

.icon-btn {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

/* ⭐ BOTONES FINALES SEPARADOS */
.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 3rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 3px solid var(--color-borde);
}

/* Botón LIMPIAR - Izquierda, peligroso */
.btn-limpiar-container {
    flex: 0;
}

.btn-limpiar {
    background: transparent;
    color: var(--color-error);
    border: 2px solid var(--color-error);
    padding: 0.75rem 1.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-limpiar:hover {
    background: var(--color-error);
    color: var(--color-blanco);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.warning-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--color-error);
    margin-top: 0.5rem;
}

/* Separador visual */
.buttons-separator {
    width: 2px;
    height: 60px;
    background: linear-gradient(to bottom, transparent, var(--color-borde), transparent);
}

/* Botón REGISTRAR - Derecha, destacado */
.btn-registrar-container {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.btn-registrar {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: var(--color-blanco);
    border: none;
    padding: 1.25rem 3rem;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

.btn-registrar:hover {
    background: linear-gradient(135deg, #218838 0%, #1aa179 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(40, 167, 69, 0.4);
}

/* ============================================
   ⭐ MODAL DE CONFIRMACIÓN
   ============================================ */
.modal-confirmacion {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal-confirmacion-content {
    background: var(--color-blanco);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: slideUp 0.3s ease;
}

.modal-confirmacion-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.modal-confirmacion h3 {
    font-size: 1.5rem;
    color: var(--color-texto);
    margin-bottom: 1rem;
}

.modal-confirmacion p {
    font-size: 1rem;
    color: var(--color-texto-claro);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.modal-confirmacion-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-confirmar-cancelar {
    background: var(--color-secundario);
    color: var(--color-blanco);
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transicion);
}

.btn-confirmar-cancelar:hover {
    background: #5c5751;
}

.btn-confirmar-limpiar {
    background: var(--color-error);
    color: var(--color-blanco);
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transicion);
}

.btn-confirmar-limpiar:hover {
    background: #c82333;
    transform: scale(1.05);
}

/* ============================================
   CAMPOS OCULTOS DINÁMICOS
   ============================================ */
.hidden-field,
.hidden-field-group {
    display: none;
    margin-top: 1rem;
}

.hidden-field-group.active,
.hidden-field.active {
    display: block;
}

/* ============================================
   ARCHIVOS
   ============================================ */
.file-label {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--color-primario);
    color: var(--color-texto);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transicion);
    margin-bottom: 1rem;
}

.file-label:hover {
    background: var(--color-primario-hover);
}

input[type="file"] {
    display: none;
}

.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.preview-container img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--color-borde);
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--color-blanco);
    padding: 2.5rem;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

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

.modal-icon {
    width: 80px;
    height: 80px;
    background: var(--color-exito);
    color: var(--color-blanco);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    margin: 0 auto 1.5rem;
}

.modal-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--color-texto);
}

.modal-content p {
    color: var(--color-texto-claro);
    margin-bottom: 1.5rem;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--color-secundario);
    color: var(--color-blanco);
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
}

.footer p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .btn-back {
        position: static;
        margin-top: 1rem;
        display: inline-block;
    }

    .logo {
        height: 35px;
    }

    .header-text h1 {
        font-size: 1.5rem;
    }

    .main {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .card {
        padding: 1.5rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .field-group {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column-reverse;
        gap: 1.5rem;
    }

    .btn-limpiar-container,
    .btn-registrar-container {
        width: 100%;
    }

    .btn-registrar,
    .btn-limpiar {
        width: 100%;
        justify-content: center;
    }

    .buttons-separator {
        display: none;
    }

    .btn-registrar {
        padding: 1rem 2rem;
        font-size: 1.1rem;
    }

    .tabla-responsive {
        overflow-x: scroll;
    }

    .tabla-productos {
        font-size: 0.875rem;
    }

    .tabla-productos th,
    .tabla-productos td {
        padding: 0.5rem;
        white-space: nowrap;
    }

    .field-total input {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .header-text h1 {
        font-size: 1.25rem;
    }

    .card {
        padding: 1rem;
    }

    .section-title {
        font-size: 1.125rem;
    }

    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }

    .field-total label {
        font-size: 1.2rem;
    }

    .field-total input {
        font-size: 1.8rem;
    }
}