/* ==========================================
   OH Hidráulica - Confirmación de Pedido
   Estilos base y UI de Checkout
========================================== */

:root {
    --primary: #1E60A8;
    --primary-dark: #0a2540;
    --secondary: #38bdf8;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--primary-dark);
}

/* ==========================================
   Header del Checkout
========================================== */
.checkout-header {
    background: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    color: var(--secondary);
}

.header-steps {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.step {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step.done {
    color: var(--success);
}

.step.active {
    color: var(--primary);
    font-weight: 600;
}

.step-divider {
    width: 30px;
    height: 2px;
    background: var(--border);
}

/* ==========================================
   Contenedor Principal
========================================== */
.checkout-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.checkout-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   Formulario de Datos
========================================== */
.checkout-form-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.checkout-form-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

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

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-main);
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: #fdfdfd;
    color: var(--text-main);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 96, 168, 0.1);
}

/* ==========================================
   Resumen / Ticket
========================================== */
.checkout-summary-section {
    position: sticky;
    top: 2rem;
}

.receipt-container {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    position: relative;
    border-top: 5px solid var(--primary);
}

/* Estilo tipo ticket dentado abajo (opcional, visual) */
.receipt-container::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background-size: 16px 16px;
    background-image: radial-gradient(circle at 8px 8px, transparent 8px, white 9px);
    background-repeat: repeat-x;
}

.receipt-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--border);
}

.receipt-header h3 {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
}

.receipt-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.receipt-items {
    margin-bottom: 1.5rem;
    min-height: 100px;
}

.r-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
}

.r-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.r-item-info {
    flex: 1;
    padding-right: 0.5rem;
    min-width: 0;
}

.r-item-name {
    font-weight: 600;
    color: var(--primary-dark);
    line-height: 1.35;
}

.r-item-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.r-item-meta-print {
    display: none;
}

.r-item-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
    overflow: hidden;
}

.btn-qty-step {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.btn-qty-step:hover {
    background: #e2e8f0;
}

.r-item-qty-input {
    width: 46px !important;
    padding: 2px 4px !important;
    border: none !important;
    border-left: 1px solid var(--border) !important;
    border-right: 1px solid var(--border) !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    text-align: center;
    font-size: 0.88rem !important;
    font-weight: 600;
    color: var(--primary-dark);
}

.r-item-qty-input:focus {
    box-shadow: none !important;
}

.btn-remove-order-item {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: var(--danger);
    border-radius: 6px;
    padding: 4px 8px;
    height: 28px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
}

.btn-remove-order-item:hover {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}

.generating-pdf .r-item-controls {
    display: none !important;
}

.generating-pdf .r-item-meta-print {
    display: block !important;
}

.r-item-price {
    font-weight: 600;
    white-space: nowrap;
}

.receipt-totals {
    border-top: 1px dashed var(--border);
    padding-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.tot-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.tot-final {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.receipt-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==========================================
   Botones de Acción
========================================== */
.checkout-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-back, .btn-confirm {
    padding: 0.85rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    transition: all 0.2s ease;
    flex: 1;
}

.btn-back {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-back:hover {
    background: #f1f5f9;
}

.btn-confirm {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(30, 96, 168, 0.3);
}

.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(30, 96, 168, 0.4);
}

/* ==========================================
   Modal de Éxito
========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 37, 64, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.success-icon {
    font-size: 4rem;
    color: var(--success);
    margin-bottom: 1rem;
}

.success-content h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.success-content p {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.success-actions {
    margin-top: 2rem;
}

.btn-primary {
    display: inline-block;
    background: var(--primary);
    color: white;
    text-decoration: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* ==========================================
   Toast Notifications
========================================== */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.payment-auto-box {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: var(--primary-dark);
}

.payment-auto-box i {
    font-size: 1.2rem;
    color: var(--primary);
    flex-shrink: 0;
}

.payment-auto-box div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.payment-auto-box strong {
    font-size: 0.98rem;
}

.payment-auto-box span {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.payment-hint {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.35;
}

/* ==========================================
   Modal de Confirmación de Continuar
========================================== */
.confirm-modal-content {
    max-width: 500px;
    padding: 2rem;
}

.confirm-warning-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: #fef3c7;
    color: #d97706;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
}

.confirm-modal-content h2 {
    font-size: 1.45rem;
    margin-bottom: 0.45rem;
    color: var(--text-main);
}

.confirm-subtitle {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 1.15rem;
}

.confirm-modal-summary {
    text-align: left;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    margin-bottom: 1.35rem;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.confirm-summary-line {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.confirm-summary-line strong {
    color: var(--text-main);
}

.confirm-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 0.85rem;
}

@media (max-width: 520px) {
    .confirm-modal-actions {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   Página de Resumen General del Pedido (resumen.html)
========================================== */
.resumen-container {
    max-width: 960px;
    margin: 2rem auto 3rem;
    padding: 0 1.25rem;
}

.resumen-top-banner {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.resumen-banner-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.resumen-banner-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #10b981;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.resumen-banner-info h1 {
    font-size: 1.35rem;
    color: #065f46;
    margin-bottom: 0.2rem;
}

.resumen-banner-info p {
    font-size: 0.92rem;
    color: #047857;
}

.resumen-actions-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-download-order {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 1.35rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s, transform 0.1s;
}

.btn-download-order:hover {
    background: var(--primary-dark);
}

.btn-download-order:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-secondary-link {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.8rem 1.15rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.btn-secondary-link:hover {
    background: #f1f5f9;
}

.order-document-card {
    background: white;
    border-radius: 12px;
    padding: 2.25rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    border-top: 6px solid var(--primary);
}

.order-doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.order-doc-company p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.order-doc-folio-box {
    text-align: right;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1.25rem;
    min-width: 220px;
}

.order-doc-type {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
}

.order-doc-folio {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0.2rem 0;
}

.order-doc-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.order-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

@media (max-width: 700px) {
    .order-info-grid {
        grid-template-columns: 1fr;
    }
    .order-doc-folio-box {
        text-align: left;
        width: 100%;
    }
}

.order-info-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem 1.15rem;
}

.order-info-panel h3 {
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary-dark);
    margin-bottom: 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.order-info-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.order-info-list div {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.order-info-list span {
    color: var(--text-muted);
}

.order-info-list strong {
    color: var(--text-main);
    text-align: right;
}

.order-table-wrapper {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.order-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.order-items-table th {
    background: #0a2540;
    color: white;
    text-align: left;
    padding: 0.75rem 0.85rem;
    font-weight: 600;
}

.order-items-table th.text-right,
.order-items-table td.text-right {
    text-align: right;
}

.order-items-table th.text-center,
.order-items-table td.text-center {
    text-align: center;
}

.order-items-table td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.order-item-sub {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.order-totals-box {
    max-width: 340px;
    margin-left: auto;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem 1.2rem;
    margin-bottom: 1.5rem;
}

.order-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.45rem;
    font-size: 0.95rem;
}

.order-total-row.discount {
    color: #059669;
    font-weight: 600;
}

.order-total-row.grand-total {
    border-top: 1px solid #cbd5e1;
    padding-top: 0.65rem;
    margin-top: 0.5rem;
    margin-bottom: 0;
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.transfer-notice-box {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    background: #eff6ff;
    border: 1.5px solid #93c5fd;
    border-left: 5px solid var(--primary);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    margin-bottom: 1.5rem;
}

.transfer-notice-box i {
    font-size: 1.35rem;
    color: var(--primary);
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.transfer-notice-title {
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
}

.transfer-notice-text {
    color: #1e293b;
    font-size: 0.92rem;
    line-height: 1.5;
}

.transfer-bank-details {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px dashed #bfdbfe;
    font-size: 0.84rem;
    color: #334155;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
}

.order-doc-footer {
    border-top: 1px dashed #cbd5e1;
    padding-top: 1rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.resumen-empty-state {
    background: white;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

@media print {
    .checkout-header,
    .resumen-top-banner {
        display: none !important;
    }
    .resumen-container {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }
    .order-document-card {
        box-shadow: none;
    }
}
