/* Casillero & Compras Online - Frontend Styles
   ------------------------------------------------------- */

:root {
    --cas-primary: #ff5a1f;
    --cas-primary-hover: #e04916;
    --cas-bg: #f6f7f9;
    --cas-card-bg: #ffffff;
    --cas-border: #e3e6ea;
    --cas-text: #1f2937;
    --cas-text-soft: #6b7280;
    --cas-danger: #dc2626;
    --cas-success: #16a34a;
    --cas-warning: #f59e0b;
    --cas-info: #2563eb;
    --cas-radius: 12px;
    --cas-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.casillero-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--cas-text);
}

.casillero-header {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    gap: 8px;
    margin-bottom: 24px;
}

.casillero-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.casillero-form {
    background: var(--cas-card-bg);
    border: 1px solid var(--cas-border);
    border-radius: var(--cas-radius);
    padding: 24px;
    box-shadow: var(--cas-shadow);
}

.casillero-form-inline {
    margin-bottom: 24px;
}

.casillero-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .casillero-row {
        grid-template-columns: 1fr;
    }
}

.casillero-field {
    margin-bottom: 18px;
}

.casillero-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}

.casillero-field .required {
    color: var(--cas-primary);
    margin-left: 2px;
}

.casillero-field input[type="text"],
.casillero-field input[type="tel"],
.casillero-field input[type="email"],
.casillero-field select,
.casillero-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--cas-border);
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.casillero-field input:focus,
.casillero-field select:focus,
.casillero-field textarea:focus {
    border-color: var(--cas-primary);
    box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.15);
    outline: none;
}

/* Section headings inside long forms (Compras Asistidas). */

/* Stepper (Compras Asistidas) — intentionally hidden by request. */
.casillero-stepper { display: none !important; }

/* Step containers. */
.casillero-step {
    animation: casillero-fade 0.18s ease;
}

.casillero-step[hidden] {
    display: none;
}

@keyframes casillero-fade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.casillero-step-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.casillero-step-spacer {
    flex: 1;
}

.casillero-section-title {
    font-size: 17px;
    font-weight: 700;
    margin: 8px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--cas-border);
    color: var(--cas-text);
}

.casillero-section-title:first-child {
    margin-top: 0;
}

/* Live info panel shown when a dropdown with extra info is selected. */
.casillero-ca-tienda-info,
.casillero-ca-pago-info {
    margin-top: 8px;
    padding: 10px 14px;
    background: var(--cas-bg);
    border-radius: 8px;
    border: 1px solid var(--cas-border);
    font-size: 14px;
}

.casillero-ca-tienda-info a,
.casillero-ca-pago-info a {
    color: var(--cas-primary);
    text-decoration: none;
    font-weight: 600;
}

.casillero-ca-tienda-info a:hover,
.casillero-ca-pago-info a:hover {
    text-decoration: underline;
}

/* Inline consent checkbox for the terms. */
.casillero-ca-terms {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    background: var(--cas-bg);
    border: 1px solid var(--cas-border);
    border-radius: 8px;
    margin-bottom: 8px;
}

.casillero-ca-terms input[type="checkbox"] {
    margin-top: 4px;
    width: 16px;
    height: 16px;
    accent-color: var(--cas-primary);
}

.casillero-ca-terms label {
    font-size: 14px;
    line-height: 1.45;
    color: var(--cas-text);
    cursor: pointer;
}

/* Submit button while submitting. */
.casillero-btn[disabled],
.casillero-btn.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Inline success banner at the top of the form. */
.casillero-form-feedback {
    margin-bottom: 16px;
}

/* File input + preview. */
.casillero-field input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px dashed var(--cas-border);
    border-radius: 8px;
    background: #fff;
    box-sizing: border-box;
    font-size: 14px;
    cursor: pointer;
}

.casillero-field input[type="file"]:focus {
    border-color: var(--cas-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.15);
}

.casillero-ca-image-preview {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--cas-bg);
    border: 1px solid var(--cas-border);
    border-radius: 8px;
}

.casillero-ca-image-preview img {
    max-width: 96px;
    max-height: 96px;
    border-radius: 6px;
    object-fit: cover;
    background: #fff;
    border: 1px solid var(--cas-border);
}

.casillero-help {
    margin: 6px 0 0;
    color: var(--cas-text-soft);
    font-size: 15px;
    max-width: 640px;
}

.casillero-help a {
    color: var(--cas-primary);
    text-decoration: none;
    font-weight: 600;
}

.casillero-info {
    float: right;
    color: var(--cas-text-soft);
    font-size: 13px;
    font-weight: 400;
}

/* Phone input with prefix. */
.casillero-phone {
    display: flex;
    align-items: center;
    border: 1px solid var(--cas-border);
    border-radius: 8px;
    overflow: hidden;
}

.casillero-phone-prefix {
    padding: 10px 12px;
    background: var(--cas-bg);
    border-right: 1px solid var(--cas-border);
    color: var(--cas-text-soft);
    font-weight: 600;
    font-size: 14px;
}

.casillero-phone input {
    border: none;
    border-radius: 0;
    flex: 1;
}

.casillero-phone input:focus {
    box-shadow: none;
}

/* Address search. */
.casillero-search {
    position: relative;
}

.casillero-search input {
    padding-left: 42px;
}

.casillero-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cas-text-soft);
    pointer-events: none;
}

.casillero-address-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--cas-border);
    border-radius: 8px;
    box-shadow: var(--cas-shadow);
    max-height: 260px;
    overflow-y: auto;
    z-index: 50;
}

.casillero-address-results .casillero-result {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--cas-border);
    font-size: 14px;
}

.casillero-address-results .casillero-result:last-child {
    border-bottom: none;
}

.casillero-address-results .casillero-result:hover {
    background: var(--cas-bg);
}

/* Buttons. */
.casillero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    line-height: 1.2;
}

.casillero-btn-primary {
    background: var(--cas-primary);
    color: #fff;
}

.casillero-btn-primary:hover {
    background: var(--cas-primary-hover);
}

.casillero-btn-secondary {
    background: var(--cas-bg);
    color: var(--cas-text);
    border-color: var(--cas-border);
}

.casillero-btn-secondary:hover {
    background: #e9ecef;
}

.casillero-btn-danger {
    background: var(--cas-danger);
    color: #fff;
}

.casillero-btn-danger:hover {
    background: #b91c1c;
}

.casillero-btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Botón "Quitar" imagen: rojo con letras blancas. */
.casillero-ca-image-clear,
.casillero-ca-image-clear.casillero-btn,
.casillero-ca-image-clear.casillero-btn-danger {
    background: var(--cas-danger);
    color: #fff;
    border-color: var(--cas-danger);
}

.casillero-ca-image-clear:hover,
.casillero-ca-image-clear.casillero-btn:hover,
.casillero-ca-image-clear.casillero-btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.casillero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.casillero-message {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
}

.casillero-message.success {
    background: #dcfce7;
    color: #166534;
}

.casillero-message.error {
    background: #fee2e2;
    color: #991b1b;
}

/* Address list (cards). */
.casillero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Single-card switcher (one card + tabs on top). */
.casillero-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 6px;
    background: #eef0f3;
    border: 1px solid var(--cas-border);
    border-radius: var(--cas-radius);
}

/* Switcher buttons with !important to override theme/Elementor. */
.casillero-wrap .casillero-switcher-btn,
button.casillero-switcher-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 16px !important;
    border: 1px solid transparent !important;
    border-radius: 8px !important;
    background-color: #e5e7eb !important;
    background-image: none !important;
    color: #1f2937 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    flex: 1 1 auto !important;
    min-width: 120px !important;
    box-shadow: none !important;
    text-shadow: none !important;
    line-height: 1.2 !important;
}

.casillero-wrap .casillero-switcher-btn:hover,
.casillero-wrap .casillero-switcher-btn:focus {
    background-color: #d8dade !important;
    background-image: none !important;
    color: #1f2937 !important;
    border-color: #9ca3af !important;
    box-shadow: none !important;
}

/* Active tab: white with black text. */
.casillero-wrap .casillero-switcher-btn.is-active,
.casillero-wrap .casillero-switcher-btn[aria-selected="true"] {
    background-color: #ffffff !important;
    background-image: none !important;
    color: #1f2937 !important;
    border-color: #d1d5db !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

/* "Copiar dirección" button: red with white text. */
.casillero-wrap .casillero-btn.casillero-btn-primary,
.casillero-wrap button.casillero-btn-primary {
    background-color: #dc2626 !important;
    background-image: none !important;
    color: #ffffff !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

.casillero-wrap .casillero-btn.casillero-btn-primary:hover,
.casillero-wrap .casillero-btn.casillero-btn-primary:focus {
    background-color: #b91c1c !important;
    background-image: none !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

/* "Anterior" button: red with white text — same tone as the primary buttons
   so the stepper (Siguiente / Anterior / Enviar) is visually consistent. */
.casillero-wrap .casillero-btn.casillero-btn-primary.casillero-ca-prev,
.casillero-wrap button.casillero-btn-primary.casillero-ca-prev {
    background-color: #dc2626 !important;
    background-image: none !important;
    color: #ffffff !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

.casillero-wrap .casillero-btn.casillero-btn-primary.casillero-ca-prev:hover,
.casillero-wrap .casillero-btn.casillero-btn-primary.casillero-ca-prev:focus {
    background-color: #b91c1c !important;
    background-image: none !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

/* Address fields rendered as definition list: label + value + per-line copy. */
.casillero-fields {
    margin: 0;
    padding: 0;
}

.casillero-field-row {
    display: grid;
    grid-template-columns: 140px 1fr 32px;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
}

.casillero-field-row + .casillero-field-row {
    border-top: 1px solid #f0f1f4;
}

.casillero-field-row dt {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--cas-text-soft);
}

.casillero-field-row dd {
    margin: 0;
    font-size: 14px;
    color: var(--cas-text);
    word-break: break-word;
    line-height: 1.4;
}

.casillero-field-row dd.casillero-addr-name {
    font-weight: 700;
}

.casillero-field-row dd.casillero-tel {
    font-weight: 600;
}

/* Per-line copy button (icon only). */
.casillero-wrap .casillero-copy-line,
button.casillero-copy-line {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    background-color: #e5e7eb !important;
    background-image: none !important;
    color: #374151 !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: all 0.15s ease !important;
    align-self: center !important;
    justify-self: end !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

.casillero-wrap .casillero-copy-line svg {
    color: #374151 !important;
    fill: none !important;
    stroke: #374151 !important;
    stroke-width: 2 !important;
}

.casillero-wrap .casillero-copy-line:hover,
.casillero-wrap .casillero-copy-line:focus,
button.casillero-copy-line:hover,
button.casillero-copy-line:focus {
    color: #1f2937 !important;
    background-color: #d8dade !important;
    background-image: none !important;
    border-color: #9ca3af !important;
    box-shadow: none !important;
}

.casillero-wrap .casillero-copy-line:focus-visible {
    outline: 2px solid var(--cas-primary) !important;
    outline-offset: 1px !important;
}

.casillero-wrap .casillero-copy-line.is-saved {
    color: var(--cas-success) !important;
    border-color: var(--cas-success) !important;
    background-color: #dcfce7 !important;
}

.casillero-panel[hidden] {
    display: none;
}

.casillero-panel {
    animation: casilleroFadeIn 0.2s ease;
}

@keyframes casilleroFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.casillero-card {
    background: var(--cas-card-bg);
    border: 1px solid var(--cas-border);
    border-radius: var(--cas-radius);
    padding: 18px;
    box-shadow: var(--cas-shadow);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.casillero-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.casillero-card-head h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.casillero-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.casillero-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    line-height: 1.2;
}

.casillero-meta-item svg {
    flex-shrink: 0;
    opacity: 0.75;
}

.casillero-meta-price {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.casillero-meta-price svg {
    opacity: 0.9;
}

.casillero-meta-price-duradero {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: #1e40af;
}

.casillero-meta-price-duradero svg {
    opacity: 0.9;
}

.casillero-badge {
    background: var(--cas-bg);
    border: 1px solid var(--cas-border);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    color: var(--cas-text-soft);
}

.casillero-card-body p {
    margin: 0 0 4px;
    font-size: 14px;
    color: var(--cas-text);
}

.casillero-card-body .casillero-addr {
    color: var(--cas-text);
}

.casillero-card-body .casillero-tel {
    margin-top: 6px;
    font-weight: 600;
}

.casillero-card-body .casillero-desc {
    margin-top: 8px;
    color: var(--cas-text-soft);
    font-style: italic;
}

.casillero-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    flex-wrap: wrap;
}

/* Tipo de envío card. */
.casillero-tipo-icon {
    display: inline-flex;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--cas-primary);
    color: #fff;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    font-size: 13px;
    font-weight: 700;
}

.casillero-tipo-aereo     { background: #2563eb; }
.casillero-tipo-maritimo  { background: #0891b2; }
.casillero-tipo-express   { background: #ef4444; }
.casillero-tipo-terrestre { background: #16a34a; }

/* Notices. */
.casillero-notice {
    border-radius: var(--cas-radius);
    padding: 14px 18px;
    margin-bottom: 18px;
    border: 1px solid var(--cas-border);
}

.casillero-notice p { margin: 0 0 8px; }
.casillero-notice a { color: var(--cas-primary); font-weight: 600; }

.casillero-notice-info    { background: #eff6ff; border-color: #bfdbfe; }
.casillero-notice-warning { background: #fef3c7; border-color: #fde68a; }
.casillero-notice-error   { background: #fee2e2; border-color: #fecaca; }

.casillero-empty {
    background: var(--cas-bg);
    padding: 32px;
    text-align: center;
    border-radius: var(--cas-radius);
    color: var(--cas-text-soft);
}

/* Read-only address list (only used by customers in Mi cuenta). */
.casillero-copy-target {
    position: absolute;
    left: -9999px;
    top: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.casillero-addr-name {
    font-weight: 600;
    color: var(--cas-text);
}

.casillero-copy-ok {
    display: inline-flex;
    align-items: center;
    color: var(--cas-success);
    font-size: 13px;
    font-weight: 600;
    margin-left: 8px;
}

