/* profile page */

.profile-page {
    min-height: 100vh;
    background: #fafafa;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.profile-main {
    padding: 2.5rem 1rem 4rem;
}

.profile-container {
    max-width: 780px;
    margin: 0 auto;
}

/* loading / error */
.profile-loading,
.profile-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 4rem 1rem;
    color: #525252;
    font-size: 0.9375rem;
}

/* root layout */
.profile-root {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.profile-page-header {
    margin-bottom: 0.25rem;
}

.profile-title {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1.5rem;
    color: #171717;
    font-weight: 700;
}

/* ─── Profile Card ─── */
.profile-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #1a2332;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.profile-name-block {
    flex: 1;
    min-width: 0;
}

.profile-full-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #171717;
    margin: 0;
}

.profile-email {
    font-size: 0.85rem;
    color: #a3a3a3;
    margin: 0.15rem 0 0;
}

.btn-profile-edit {
    padding: 0.4rem 1rem;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    color: #525252;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.btn-profile-edit:hover {
    border-color: #a3a3a3;
    color: #171717;
}

/* profile details (read-only) */
.profile-details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-top: 0.25rem;
    border-top: 1px solid #f5f5f5;
}

.profile-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #525252;
}

.profile-detail-label {
    color: #a3a3a3;
    font-size: 0.8rem;
}

/* edit form */
.profile-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f5f5f5;
}

.profile-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.profile-field-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #a3a3a3;
}

.profile-field input {
    padding: 0.55rem 0.75rem;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    color: #171717;
    transition: border-color 0.15s ease;
}

.profile-field input:focus {
    outline: none;
    border-color: #1a2332;
}

.profile-edit-actions {
    display: flex;
    gap: 0.6rem;
    padding-top: 0.25rem;
}

.btn-profile-save {
    padding: 0.5rem 1.2rem;
    background: #0a0a0a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-profile-save:hover { background: #262626; }
.btn-profile-save:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-profile-cancel {
    padding: 0.5rem 1.2rem;
    background: none;
    color: #525252;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.btn-profile-cancel:hover { border-color: #a3a3a3; }

/* message */
.profile-message {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    margin: 0;
}

.profile-message.success {
    background: #f0fdf4;
    color: #15803d;
}

.profile-message.error {
    background: #fef2f2;
    color: #dc2626;
}

/* ─── Sections (Orders, Addresses, Account) ─── */
.profile-section {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.profile-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.profile-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a3a3a3;
    margin: 0;
}

.profile-section-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1a2332;
    text-decoration: none;
}

.profile-section-link:hover { text-decoration: underline; }

.profile-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
    color: #a3a3a3;
    text-align: center;
    font-size: 0.9rem;
}

.btn-profile-action {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    background: #0a0a0a;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
    transition: background 0.15s ease;
}

.btn-profile-action:hover { background: #262626; }

/* ─── Recent Orders ─── */
.profile-orders-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.profile-order-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f5f5f5;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s ease;
}

.profile-order-row:last-child { border-bottom: none; }
.profile-order-row:hover { background: #fafafa; margin: 0 -1.25rem; padding-left: 1.25rem; padding-right: 1.25rem; }

.profile-order-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 120px;
}

.profile-order-id {
    font-weight: 700;
    font-size: 0.9rem;
    color: #171717;
}

.profile-order-date {
    font-size: 0.78rem;
    color: #a3a3a3;
}

.profile-order-meta {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: #525252;
}

.profile-order-total {
    font-weight: 600;
    color: #171717;
}

/* reuse status badge from orders */
.order-status-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--badge-color) 12%, transparent);
    color: var(--badge-color);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ─── Addresses ─── */
.profile-addresses {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.75rem;
}

.profile-address-card {
    padding: 0.85rem;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #171717;
    line-height: 1.6;
}

.profile-address-card p { margin: 0; }

.address-name {
    font-weight: 600;
    margin-bottom: 0.15rem !important;
}

/* ─── Account Management (Danger Zone) ─── */
.profile-section--danger {
    border-color: #fecaca;
}

.profile-account-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem;
    background: #fafafa;
    border: 1px solid #f5f5f5;
    border-radius: 8px;
}

.account-option-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #171717;
    margin: 0 0 0.2rem;
}

.account-option-desc {
    font-size: 0.78rem;
    color: #a3a3a3;
    margin: 0;
    max-width: 400px;
}

.btn-profile-delete {
    padding: 0.45rem 1rem;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    color: #dc2626;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-profile-delete:hover { background: #fef2f2; border-color: #f87171; }

/* confirm dialog */
.profile-confirm-box {
    padding: 1.25rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-confirm-box--delete {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.confirm-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fef2f2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-title {
    font-weight: 700;
    font-size: 1rem;
    color: #171717;
    margin: 0;
}

.confirm-desc {
    font-size: 0.85rem;
    color: #525252;
    margin: 0;
    line-height: 1.55;
}

.confirm-consequences {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.82rem;
    color: #7f1d1d;
    line-height: 1.7;
}

.confirm-consequences li::marker {
    color: #dc2626;
}

.confirm-warning-box {
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 0.85rem;
}

.confirm-warning-title {
    font-weight: 600;
    font-size: 0.82rem;
    color: #991b1b;
    margin: 0 0 0.4rem;
}

.confirm-reactivate-note {
    font-size: 0.82rem;
    color: #525252;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 0.7rem 0.85rem;
    line-height: 1.5;
}

.confirm-email-note {
    font-size: 0.78rem;
    color: #a3a3a3;
    margin: 0;
}

.confirm-type-label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: #525252;
    font-weight: 500;
}

.confirm-type-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    color: #dc2626;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: #fff;
    width: 100%;
    max-width: 200px;
}

.confirm-type-input:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

.confirm-type-input::placeholder {
    color: #d4d4d4;
    font-weight: 400;
}

.confirm-actions {
    display: flex;
    gap: 0.6rem;
    padding-top: 0.25rem;
}

.btn-confirm-delete {
    padding: 0.5rem 1.2rem;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-confirm-delete:hover { background: #b91c1c; }
.btn-confirm-delete:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-confirm-cancel {
    padding: 0.5rem 1.2rem;
    background: #fff;
    color: #525252;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-confirm-cancel:hover { border-color: #a3a3a3; }

/* ─── Responsive ─── */
@media (max-width: 580px) {
    .profile-field-row { grid-template-columns: 1fr; }
    .profile-title { font-size: 1.25rem; }
    .profile-addresses { grid-template-columns: 1fr; }
    .profile-account-option { flex-direction: column; align-items: flex-start; }
    .profile-order-row { flex-wrap: wrap; gap: 0.5rem; }
}

@media (max-width: 480px) {
    .profile-main { padding: 1.5rem 0.875rem 3rem; }
    .profile-card { padding: 1rem; }
    .profile-section { padding: 1rem; }
    .profile-avatar { width: 44px; height: 44px; font-size: 0.95rem; }
    .confirm-actions { flex-direction: column; }
}
