/* ===============================================================
   ReUse Market — Profile / Account Pages
   Warm & Crafted · DM Sans + Fraunces · Earthy palette
   =============================================================== */

/* ── Page wrapper ── */
.rd-profile-page {
    padding: 36px 0 64px;
    background: var(--rd-bg);
    min-height: 60vh;
}

/* ════════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════════ */
.rd-profile-sidebar {
    background: var(--rd-warm-white);
    border: 1px solid var(--rd-border);
    border-radius: var(--rd-radius-xl);
    overflow: hidden;
    position: sticky;
    top: 20px;
}

/* Identity block */
.rd-profile-sidebar__identity {
    padding: 28px 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    background: linear-gradient(160deg, var(--rd-forest-dark) 0%, var(--rd-forest) 100%);
    position: relative;
}

.rd-profile-sidebar__avatar-wrap {
    position: relative;
    display: inline-block;
}

.rd-profile-sidebar__avatar {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.25);
}

.rd-profile-sidebar__avatar-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px dashed rgba(255,255,255,0.3);
    pointer-events: none;
}

.rd-profile-sidebar__name-wrap {
    color: #fff;
}

.rd-profile-sidebar__name {
    font-family: var(--rd-font-display);
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 2px;
    color: #fff;
}

.rd-profile-sidebar__joined {
    font-size: 11px;
    color: rgba(255,255,255,0.65);
    margin: 0;
    letter-spacing: 0.03em;
}

.rd-profile-sidebar__danger-wrap {
    position: absolute;
    top: 12px;
    right: 12px;
}

.rd-profile-sidebar__danger-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: transparent;
    color: rgba(255,255,255,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--rd-transition);
}
.rd-profile-sidebar__danger-btn:hover {
    background: rgba(220,53,69,0.85);
    border-color: transparent;
    color: #fff;
}

/* Nav */
.rd-profile-sidebar__nav {
    padding: 12px 0;
}

.rd-profile-sidebar__nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rd-profile-sidebar__nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--rd-text-secondary);
    text-decoration: none;
    transition: background var(--rd-transition), color var(--rd-transition);
    border-left: 3px solid transparent;
}

.rd-profile-sidebar__nav li a:hover {
    background: var(--rd-forest-50);
    color: var(--rd-forest);
}

.rd-profile-sidebar__nav li.rd-active a {
    background: var(--rd-forest-50);
    color: var(--rd-forest);
    border-left-color: var(--rd-forest);
    font-weight: 600;
}

.rd-profile-nav__icon {
    width: 28px;
    height: 28px;
    border-radius: var(--rd-radius);
    background: var(--rd-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    transition: background var(--rd-transition);
}

.rd-profile-sidebar__nav li.rd-active .rd-profile-nav__icon,
.rd-profile-sidebar__nav li a:hover .rd-profile-nav__icon {
    background: rgba(45,106,79,0.15);
}

/* Logout */
.rd-profile-sidebar__logout {
    padding: 8px 16px 12px;
    border-top: 1px solid var(--rd-border);
    margin-top: 4px;
}

.rd-profile-sidebar__logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--rd-radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--rd-text-muted);
    text-decoration: none;
    transition: all var(--rd-transition);
    width: 100%;
}

.rd-profile-sidebar__logout-btn:hover {
    background: rgba(220,53,69,0.06);
    color: #b02a37;
}

/* Mobile toggle */
.rd-profile-sidebar__mobile-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--rd-cream);
    border: 1px solid var(--rd-border);
    border-radius: var(--rd-radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--rd-text);
    cursor: pointer;
    width: 100%;
    margin-bottom: 12px;
}

.rd-profile-sidebar__nav.rd-open { display: block !important; }

.rd-profile-sidebar__overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 100;
}
.rd-profile-sidebar__overlay.rd-open { display: block; }

/* ════════════════════════════════════════════════════════════════
   STATS STRIP
   ════════════════════════════════════════════════════════════════ */
.rd-profile-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.rd-profile-stat {
    flex: 1;
    background: var(--rd-warm-white);
    border: 1px solid var(--rd-border);
    border-radius: var(--rd-radius-lg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rd-profile-stat__value {
    font-family: var(--rd-font-display);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--rd-forest);
    line-height: 1;
}

.rd-profile-stat__label {
    font-size: 12px;
    font-weight: 500;
    color: var(--rd-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ════════════════════════════════════════════════════════════════
   PROFILE CARD (sections)
   ════════════════════════════════════════════════════════════════ */
.rd-profile-card {
    background: var(--rd-warm-white);
    border: 1px solid var(--rd-border);
    border-radius: var(--rd-radius-xl);
    overflow: hidden;
}

.rd-profile-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--rd-border);
}

.rd-profile-card__title {
    font-family: var(--rd-font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--rd-text);
    margin: 0;
}

.rd-profile-card__edit {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--rd-forest);
    text-decoration: none;
    transition: opacity var(--rd-transition);
}
.rd-profile-card__edit:hover { opacity: 0.75; }

.rd-profile-card__body {
    padding: 24px;
}

/* Detail rows */
.rd-profile-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.rd-profile-detail {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.rd-profile-detail__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--rd-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.rd-profile-detail__value {
    font-size: 14px;
    font-weight: 500;
    color: var(--rd-text);
}
.rd-profile-detail__value a {
    color: var(--rd-text);
    text-decoration: none;
}
.rd-profile-detail__value a:hover { color: var(--rd-forest); }

/* ════════════════════════════════════════════════════════════════
   ADDRESS CARDS
   ════════════════════════════════════════════════════════════════ */
.rd-address-card {
    background: var(--rd-cream);
    border: 1px solid var(--rd-border);
    border-radius: var(--rd-radius-lg);
    padding: 16px 18px;
    height: 100%;
    transition: border-color var(--rd-transition), box-shadow var(--rd-transition);
}

.rd-address-card:hover {
    border-color: var(--rd-sage);
    box-shadow: var(--rd-shadow-sm);
}

.rd-address-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.rd-address-card__type {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--rd-text);
    text-transform: capitalize;
}

.rd-address-card__badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--rd-radius-pill);
    background: rgba(45,106,79,0.1);
    color: var(--rd-forest);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rd-address-card__actions {
    display: flex;
    gap: 4px;
}

.rd-address-card__btn {
    width: 28px;
    height: 28px;
    border-radius: var(--rd-radius);
    border: 1px solid var(--rd-border);
    background: var(--rd-warm-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--rd-text-secondary);
    text-decoration: none;
    transition: all var(--rd-transition);
}

.rd-address-card__btn:hover {
    background: var(--rd-forest);
    border-color: var(--rd-forest);
    color: #fff;
}

.rd-address-card__btn--danger:hover {
    background: #b02a37;
    border-color: #b02a37;
    color: #fff;
}

.rd-address-card__body { }
.rd-address-card__name  { font-size: 13.5px; font-weight: 600; color: var(--rd-text); margin: 0 0 2px; }
.rd-address-card__phone { font-size: 12px; color: var(--rd-text-muted); margin: 0 0 4px; }
.rd-address-card__addr  { font-size: 12.5px; color: var(--rd-text-secondary); margin: 0; line-height: 1.5; }

/* ════════════════════════════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════════════════════════════ */
.rd-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 32px 20px;
    text-align: center;
}

.rd-empty-state img { opacity: 0.65; }

.rd-empty-state p {
    font-size: 13.5px;
    color: var(--rd-text-muted);
    margin: 0;
}

.rd-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: var(--rd-radius-pill);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--rd-transition);
    cursor: pointer;
    border: none;
}

.rd-btn--outline {
    border: 1.5px solid var(--rd-forest);
    color: var(--rd-forest);
    background: transparent;
}
.rd-btn--outline:hover {
    background: var(--rd-forest);
    color: #fff;
}

/* ════════════════════════════════════════════════════════════════
   ADDRESS FORM — add / edit
   ════════════════════════════════════════════════════════════════ */

/* Section block (label chooser, type chooser) */
.rd-addr-section {
    margin-bottom: 24px;
}

.rd-addr-section__heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--rd-text-muted);
    margin: 0 0 10px;
}

/* ── Address-type toggle buttons (Home / Permanent / Office) ── */
.rd-addr-type-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rd-addr-type-btn { cursor: pointer; }

.rd-addr-type-btn__inner {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: var(--rd-radius-pill);
    border: 1.5px solid var(--rd-border);
    background: var(--rd-warm-white);
    font-size: 13px;
    font-weight: 600;
    color: var(--rd-text-secondary);
    transition: all var(--rd-transition);
    user-select: none;
}

.rd-addr-type-btn input:checked + .rd-addr-type-btn__inner {
    background: var(--rd-forest);
    border-color: var(--rd-forest);
    color: #fff;
    box-shadow: 0 4px 12px rgba(45,106,79,0.25);
}

.rd-addr-type-btn__inner:hover {
    border-color: var(--rd-sage);
    color: var(--rd-forest);
}

/* ── Billing / Shipping radio group ── */
.rd-addr-radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.rd-addr-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--rd-text-secondary);
    transition: color var(--rd-transition);
}

.rd-addr-radio input[type="radio"] {
    display: none;
}

.rd-addr-radio__box {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--rd-border);
    background: var(--rd-warm-white);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--rd-transition);
    position: relative;
}

.rd-addr-radio__box::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    transform: scale(0);
    transition: transform var(--rd-transition);
}

.rd-addr-radio input:checked ~ .rd-addr-radio__box {
    border-color: var(--rd-forest);
    background: var(--rd-forest);
}

.rd-addr-radio input:checked ~ .rd-addr-radio__box::after {
    transform: scale(1);
}

.rd-addr-radio input:checked ~ span:last-child,
.rd-addr-radio:has(input:checked) {
    color: var(--rd-text);
    font-weight: 600;
}

/* ── Form fields ── */
.rd-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rd-form-group__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--rd-text-secondary);
    margin: 0;
}

.rd-form-group__inner {
    position: relative;
}

.rd-form-group__icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--rd-text-muted);
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
}

.rd-form-group__input {
    width: 100%;
    border: 1.5px solid var(--rd-border) !important;
    border-radius: var(--rd-radius) !important;
    background: var(--rd-warm-white) !important;
    font-size: 14px !important;
    color: var(--rd-text) !important;
    padding: 10px 14px !important;
    transition: border-color var(--rd-transition), box-shadow var(--rd-transition) !important;
    box-shadow: none !important;
    font-family: var(--rd-font-body) !important;
}

.rd-form-group__input--icon {
    padding-left: 38px !important;
}

.rd-form-group__input:focus,
.rd-form-group__input:focus-visible {
    border-color: var(--rd-forest) !important;
    box-shadow: 0 0 0 3px var(--rd-forest-50) !important;
    outline: none !important;
    background: #fff !important;
}

.rd-form-group__input::placeholder {
    color: var(--rd-text-muted) !important;
    font-size: 13px !important;
}

textarea.rd-form-group__input {
    resize: vertical;
    min-height: 100px;
}

/* Select2 override */
.rd-form-group .select2-container .select2-selection--single {
    height: auto !important;
    border: 1.5px solid var(--rd-border) !important;
    border-radius: var(--rd-radius) !important;
    background: var(--rd-warm-white) !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
}
.rd-form-group .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--rd-text) !important;
    line-height: 1.4 !important;
    padding: 0 !important;
}
.rd-form-group .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
    top: 0 !important;
    right: 10px !important;
}
.rd-form-group .select2-container--default.select2-container--focus .select2-selection--single,
.rd-form-group .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--rd-forest) !important;
    box-shadow: 0 0 0 3px var(--rd-forest-50) !important;
}

/* ── Map canvas ── */
.rd-map-canvas {
    width: 100%;
    height: 280px;
    border-radius: var(--rd-radius-lg);
    border: 1.5px solid var(--rd-border);
    overflow: hidden;
    background: var(--rd-cream-dark);
}

/* ── Form actions ── */
.rd-form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 8px;
    flex-wrap: wrap;
}

.rd-form-actions__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 28px;
    border-radius: var(--rd-radius-pill);
    background: var(--rd-forest);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid var(--rd-forest);
    cursor: pointer;
    font-family: var(--rd-font-body);
    transition: all var(--rd-transition);
}

.rd-form-actions__submit:hover {
    background: var(--rd-forest-dark);
    border-color: var(--rd-forest-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(45,106,79,0.3);
}

.rd-form-actions__reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--rd-radius-pill);
    background: transparent;
    color: var(--rd-text-secondary);
    font-size: 14px;
    font-weight: 500;
    border: 1.5px solid var(--rd-border);
    cursor: pointer;
    font-family: var(--rd-font-body);
    transition: all var(--rd-transition);
}

.rd-form-actions__reset:hover {
    border-color: var(--rd-text-secondary);
    color: var(--rd-text);
    background: var(--rd-cream);
}

/* Edit form spacing */
.rd-edit-form { }
.rd-edit-form .rd-addr-section + .rd-addr-section {
    border-top: 1px solid var(--rd-border);
    padding-top: 24px;
}
.rd-edit-form .rd-addr-section:last-of-type {
    border-bottom: 1px solid var(--rd-border);
    padding-bottom: 24px;
    margin-bottom: 28px;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
    .rd-profile-sidebar {
        position: static;
    }
    .rd-profile-sidebar__nav {
        display: none;
    }
    .rd-profile-sidebar__nav.rd-open {
        display: block !important;
    }
}

@media (max-width: 576px) {
    .rd-profile-details {
        grid-template-columns: 1fr;
    }
    .rd-profile-page { padding: 20px 0 40px; }
    .rd-profile-card__body { padding: 16px; }
}
