/* ============================================
   BIM Customer Profile — Mi Perfil
   ============================================
   Profile management page for personal and
   delivery information. All fields optional.

   Specificity: Uses `body .bim-profile-*` to
   win over WordPress theme defaults.
   ============================================ */

/* ── PAGE CONTAINER ── */
body .bim-profile-page {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--bim-space-4) var(--bim-space-4) var(--bim-space-8);
}

/* ── BACK LINK ── */
body a.bim-profile-back {
    display: inline-flex;
    align-items: center;
    gap: var(--bim-space-1);
    font-size: var(--bim-text-sm);
    font-weight: 600;
    color: var(--bim-text-muted) !important;
    text-decoration: none !important;
    margin-bottom: var(--bim-space-4);
    transition: color 0.2s;
}

body a.bim-profile-back:hover {
    color: var(--bim-text-primary) !important;
}

body a.bim-profile-back .material-symbols-outlined {
    font-size: 18px;
}

/* ── IDENTITY BANNER ── */
body .bim-profile-banner {
    background: var(--bim-surface);
    border: 1px solid var(--bim-border);
    border-radius: var(--bim-radius);
    padding: var(--bim-space-6);
    margin-bottom: var(--bim-space-4);
    box-shadow: var(--bim-shadow-sm);
}

body .bim-profile-banner-top {
    display: flex;
    align-items: center;
    gap: var(--bim-space-4);
    margin-bottom: var(--bim-space-5);
}

body .bim-profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bim-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.25);
}

body .bim-profile-avatar-initials {
    font-size: var(--bim-text-lg);
    font-weight: 900;
    color: var(--bim-surface);
    letter-spacing: 0.02em;
    line-height: 1;
}

body .bim-profile-banner-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

body .bim-profile-banner-name {
    font-size: var(--bim-text-lg);
    font-weight: 800;
    color: var(--bim-text-primary);
    margin: 0;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body .bim-profile-banner-email {
    font-size: var(--bim-text-sm);
    font-weight: 500;
    color: var(--bim-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── PROGRESS BAR ── */
body .bim-profile-progress {
    background: var(--bim-bg);
    border-radius: var(--bim-radius-sm);
    padding: var(--bim-space-3) var(--bim-space-4);
}

body .bim-profile-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--bim-space-2);
}

body .bim-profile-progress-label {
    font-size: var(--bim-text-sm);
    font-weight: 600;
    color: var(--bim-text-secondary);
}

body .bim-profile-progress-count {
    font-size: var(--bim-text-sm);
    font-weight: 700;
    color: var(--bim-text-muted);
}

body .bim-profile-progress-track {
    height: 6px;
    background: var(--bim-border);
    border-radius: 3px;
    overflow: hidden;
}

body .bim-profile-progress-fill {
    height: 100%;
    background: var(--bim-accent);
    border-radius: 3px;
    transition: width 0.5s ease;
    min-width: 4px;
}

/* ── SECTIONS ── */
body .bim-profile-section {
    background: var(--bim-surface);
    border: 1px solid var(--bim-border);
    border-radius: var(--bim-radius);
    padding: var(--bim-space-6);
    margin-bottom: var(--bim-space-4);
    box-shadow: var(--bim-shadow-sm);
}

body .bim-profile-section-header {
    display: flex;
    align-items: flex-start;
    gap: var(--bim-space-3);
    margin-bottom: var(--bim-space-5);
    padding-bottom: var(--bim-space-4);
    border-bottom: 1px solid var(--bim-border-light);
}

body .bim-profile-section-icon {
    font-size: 24px;
    color: var(--bim-info);
    background: var(--bim-info-light);
    border-radius: var(--bim-radius-sm);
    padding: var(--bim-space-2);
    flex-shrink: 0;
    line-height: 1;
}

/* Delivery section: green tint */
body .bim-profile-section-icon.bim-profile-section-icon--delivery {
    color: var(--bim-success);
    background: var(--bim-success-light);
}

body .bim-profile-section-title {
    font-size: var(--bim-text-base);
    font-weight: 700;
    color: var(--bim-text-primary);
    margin: 0 0 var(--bim-space-1) 0;
    line-height: 1.3;
}

body .bim-profile-section-desc {
    font-size: var(--bim-text-sm);
    color: var(--bim-text-muted);
    margin: 0;
    font-weight: 500;
}

/* ── FIELDS GRID ── */
body .bim-profile-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--bim-space-4);
}

body .bim-profile-field {
    grid-column: 1 / -1;
}

body .bim-profile-field--half {
    grid-column: auto;
}

/* ── LABELS ── */
body .bim-profile-label {
    display: block;
    font-size: var(--bim-text-sm);
    font-weight: 600;
    color: var(--bim-text-secondary);
    margin-bottom: var(--bim-space-2);
}

/* ── INPUT WRAPPER WITH ICON ── */
body .bim-profile-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

body .bim-profile-input-wrap--textarea {
    align-items: flex-start;
}

body .bim-profile-input-icon {
    position: absolute;
    left: var(--bim-space-3);
    font-size: 20px;
    color: var(--bim-text-faint);
    pointer-events: none;
    z-index: 1;
}

body .bim-profile-input-wrap--textarea .bim-profile-input-icon {
    top: var(--bim-space-3);
}

/* Override forms.css input to add left padding for icon */
body input.bim-input.bim-profile-input,
body textarea.bim-textarea.bim-profile-input,
body select.bim-profile-input {
    padding-left: 2.75rem !important;
    font-weight: 600 !important;
}

body input.bim-input.bim-profile-input::placeholder,
body textarea.bim-textarea.bim-profile-input::placeholder {
    font-weight: 500;
    color: var(--bim-text-faint);
}

/* Focus state: icon color follows */
body .bim-profile-input-wrap:focus-within .bim-profile-input-icon {
    color: var(--bim-accent);
}

/* ── TEXTAREA ── */
body textarea.bim-textarea.bim-profile-textarea {
    resize: vertical;
    min-height: 60px;
    line-height: 1.5;
    width: 100% !important;
    background-color: var(--bim-surface) !important;
    border: 1px solid var(--bim-border) !important;
    border-radius: var(--bim-radius-sm) !important;
    font-size: var(--bim-text-base);
    font-family: var(--bim-font);
    color: var(--bim-text-secondary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

body textarea.bim-textarea.bim-profile-textarea:focus {
    outline: none !important;
    border-color: var(--bim-accent) !important;
    box-shadow: 0 0 0 1px var(--bim-accent) !important;
}

/* ── RADIO CARDS ── */
body .bim-profile-radio-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--bim-space-3);
}

body .bim-profile-radio-card {
    display: flex;
    align-items: center;
    gap: var(--bim-space-3);
    padding: var(--bim-space-4);
    background: var(--bim-surface);
    border: 2px solid var(--bim-border);
    border-radius: var(--bim-radius-sm);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    position: relative;
}

body .bim-profile-radio-card:hover {
    border-color: var(--bim-text-faint);
    box-shadow: var(--bim-shadow-sm);
}

body .bim-profile-radio-card--active {
    border-color: var(--bim-info) !important;
    background: rgba(99, 102, 241, 0.04) !important;
    box-shadow: 0 0 0 1px var(--bim-info);
}

body .bim-profile-radio-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

body .bim-profile-radio-icon {
    font-size: 24px;
    color: var(--bim-text-faint);
    flex-shrink: 0;
}

body .bim-profile-radio-card--active .bim-profile-radio-icon {
    color: var(--bim-info);
}

body .bim-profile-radio-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

body .bim-profile-radio-title {
    font-size: var(--bim-text-sm);
    font-weight: 700;
    color: var(--bim-text-primary);
}

body .bim-profile-radio-desc {
    font-size: 11px;
    font-weight: 500;
    color: var(--bim-text-muted);
}

body .bim-profile-radio-check {
    font-size: 22px;
    color: transparent;
    flex-shrink: 0;
    transition: color 0.2s;
}

body .bim-profile-radio-card--active .bim-profile-radio-check {
    color: var(--bim-info);
}

/* ── SAVE BUTTON ── */
body .bim-profile-actions {
    padding-top: var(--bim-space-2);
}

body button.bim-btn.bim-profile-save-btn {
    width: 100%;
    gap: var(--bim-space-2);
}

body button.bim-btn.bim-profile-save-btn .material-symbols-outlined {
    font-size: 20px;
}

/* ── SUCCESS STATE ── */
body button.bim-btn.bim-profile-save-btn.bim-profile-saved {
    background: var(--bim-success) !important;
    box-shadow: 0 10px 15px -3px rgba(22, 163, 74, 0.3) !important;
}

body button.bim-btn.bim-profile-save-btn.bim-profile-saved:hover {
    background: var(--bim-success-dark) !important;
}

/* ── RESPONSIVE: TABLET (≤768px) ── */
@media (max-width: 768px) {
    body .bim-profile-radio-group {
        grid-template-columns: 1fr;
    }
}

/* ── RESPONSIVE: MOBILE (≤640px) ── */
@media (max-width: 640px) {
    body .bim-profile-page {
        padding: var(--bim-space-3) var(--bim-space-3) var(--bim-space-6);
    }

    body .bim-profile-banner,
    body .bim-profile-section {
        padding: var(--bim-space-4);
    }

    body .bim-profile-banner-top {
        gap: var(--bim-space-3);
    }

    body .bim-profile-avatar {
        width: 44px;
        height: 44px;
    }

    body .bim-profile-avatar-initials {
        font-size: var(--bim-text-sm);
    }

    body .bim-profile-banner-name {
        font-size: var(--bim-text-base);
    }

    body .bim-profile-banner-email {
        font-size: 11px;
    }

    body .bim-profile-section-header {
        gap: var(--bim-space-2);
    }

    body .bim-profile-section-icon {
        padding: 6px;
        font-size: 20px;
    }

    body .bim-profile-fields {
        grid-template-columns: 1fr;
    }

    body .bim-profile-field--half {
        grid-column: 1 / -1;
    }

    body .bim-profile-radio-card {
        padding: var(--bim-space-3);
        gap: var(--bim-space-2);
    }

    body .bim-profile-radio-icon {
        font-size: 20px;
    }

    body .bim-profile-radio-check {
        font-size: 18px;
    }
}
