/* ============================================
   FindPrices — Account Section Shared Styles
   Unified component system for all account pages
   ============================================ */

/* ---------- Page Container ---------- */
.account-container {
    padding: var(--space-xl) 0 var(--space-2xl);
    min-height: calc(100vh - 200px);
    background: var(--bg-light);
}

/* ---------- Content Grid ---------- */
.account-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    max-width: var(--account-max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Card System ---------- */
.account-card {
    background: var(--white);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.account-card:hover {
    box-shadow: var(--shadow-hover);
}

.account-card h2 {
    margin-bottom: var(--space-md);
    color: var(--text-color);
    font-size: var(--text-xl);
    font-weight: 700;
}

.account-card h3 {
    margin-bottom: var(--space-sm);
    color: var(--text-color);
    font-size: var(--text-lg);
    font-weight: 600;
}

.account-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.two-col-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

/* ---------- Profile Card ---------- */
.account-card--profile {
    overflow: hidden;
    padding: 0;
}

.profile-header-bg {
    padding: var(--space-xl) var(--space-lg) var(--space-lg);
    background: linear-gradient(135deg, #e8f5e9 0%, #f0fdf4 50%, #ffffff 100%);
    border-bottom: 1px solid var(--border-light);
}

.profile-display {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
}

.profile-photo-container {
    position: relative;
    flex-shrink: 0;
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
    display: none;
}

.profile-photo.loaded {
    display: block;
}

.profile-photo-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light) 0%, #f1f8f4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    border: 4px solid var(--primary-color);
}

.profile-photo.loaded ~ .profile-photo-placeholder {
    display: none;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    flex: 1;
}

.profile-name {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

.profile-email {
    font-size: var(--text-base);
    color: var(--text-light);
    margin: 0;
}

.profile-meta {
    font-size: var(--text-sm);
    color: var(--text-light);
    margin: 0;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-light);
}

.profile-meta strong {
    color: var(--text-color);
}

/* ---------- Badge System ---------- */
.account-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: var(--text-sm);
    line-height: 1;
    letter-spacing: 0.02em;
}

.account-badge--member {
    background: var(--primary-light);
    color: var(--primary-color);
}

.account-badge--ambassador {
    background: linear-gradient(135deg, #e8f5e9 0%, #d4edda 100%);
    color: var(--primary-color);
}

.account-badge--legend {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    color: var(--warning-color);
}

.account-badge--vip {
    background: linear-gradient(135deg, #ede7f6 0%, #d1c4e9 100%);
    color: #7c3aed;
}

.account-badge--admin {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
}

.account-badge--danger {
    background: var(--error-light);
    color: var(--error-color);
}

.count-badge {
    background: var(--primary-color);
    color: var(--white);
    padding: var(--space-xs) 10px;
    border-radius: var(--radius-pill);
    font-size: var(--text-sm);
    font-weight: 600;
}

/* ---------- Tier CTA ---------- */
.tier-cta {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    background: #f6fbf7;
    border: 1px solid #e3f1e6;
}

.tier-cta p {
    margin: 0 0 10px;
    font-size: var(--text-sm);
    color: var(--text-light);
}

.tier-cta .btn {
    width: 100%;
}

/* ---------- Progress Bar ---------- */
.account-progress {
    margin: var(--space-md) 0;
}

.account-progress__bar {
    width: 100%;
    height: 10px;
    background: var(--border-light);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.account-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    transition: width 0.5s ease;
    border-radius: var(--radius-pill);
}

.account-progress__text {
    font-size: var(--text-sm);
    color: var(--text-light);
    text-align: center;
}

/* ---------- Form Controls ---------- */
.account-form-group {
    margin-bottom: var(--space-md);
}

.account-form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 600;
    color: var(--text-color);
    font-size: var(--text-sm);
}

.account-input,
.account-select,
.account-form-group input,
.account-form-group select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: var(--text-base);
    font-family: inherit;
    background: var(--white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.account-input:focus,
.account-select:focus,
.account-form-group input:focus,
.account-form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

/* ---------- Toggle Switch ---------- */
.account-toggle {
    position: relative;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.account-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.account-toggle__slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #ccc;
    transition: 0.3s;
    border-radius: var(--radius-pill);
}

.account-toggle__slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.account-toggle input:checked + .account-toggle__slider {
    background: var(--primary-color);
}

.account-toggle input:checked + .account-toggle__slider::before {
    transform: translateX(22px);
}

/* ---------- Preference Items ---------- */
.preference-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-light);
}

.preference-item:last-child {
    border-bottom: none;
}

.preference-info {
    flex: 1;
    margin-right: var(--space-md);
}

.preference-info h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 var(--space-xs);
}

.preference-info p {
    font-size: var(--text-sm);
    color: var(--text-light);
    margin: 0;
    line-height: 1.5;
}

/* ---------- Alert Messages ---------- */
.account-alert {
    padding: var(--space-md);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    text-align: center;
    display: none;
}

.account-alert.active {
    display: block;
}

.account-alert--success {
    background: var(--success-light);
    color: var(--success-text);
}

.account-alert--error {
    background: #f8d7da;
    color: #721c24;
}

/* ---------- Inner Section Blocks ---------- */
.account-section {
    padding: var(--space-md);
    background: var(--bg-light);
    border-radius: var(--radius);
    margin-bottom: var(--space-md);
}

.account-section:last-child {
    margin-bottom: 0;
}

.account-section h3 {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-color);
}

.account-section p {
    font-size: var(--text-sm);
    color: var(--text-light);
    margin-bottom: var(--space-sm);
    line-height: 1.5;
}

/* ---------- Activity Stats ---------- */
.activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-sm);
}

.activity-stat-card {
    background: var(--white);
    padding: var(--space-md);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.activity-stat-card__value {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--primary-color);
}

.activity-stat-card__label {
    font-size: var(--text-xs);
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---------- Danger Zone ---------- */
.account-danger {
    padding: var(--space-md);
    background: var(--error-light);
    border-radius: var(--radius);
    border: 2px solid var(--error-border);
}

.account-danger h3 {
    color: var(--error-color);
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.account-danger p {
    font-size: var(--text-sm);
    color: var(--text-light);
    margin-bottom: var(--space-sm);
    line-height: 1.5;
}

.btn-danger {
    background: var(--white);
    color: var(--error-color);
    border: 2px solid var(--error-color);
}

.btn-danger:hover {
    background: var(--error-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* ---------- Modal ---------- */
.account-modal {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    z-index: 10000;
}

.account-modal.active {
    display: flex;
}

.account-modal__card {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-lg);
    text-align: left;
}

.account-modal__card h3 {
    margin-bottom: var(--space-sm);
    font-size: var(--text-lg);
    font-weight: 700;
}

.account-modal__card p {
    color: var(--text-light);
    font-size: var(--text-sm);
    line-height: 1.5;
    margin-bottom: 0;
}

.account-modal__actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
    margin-top: var(--space-md);
}

.account-modal__actions .btn {
    padding: 10px 18px;
}

/* ---------- Loading Overlay ---------- */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

/* ---------- Sign-out Section ---------- */
.sign-out-section {
    text-align: center;
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-light);
}

/* ---------- Utility ---------- */
.btn-full {
    width: 100%;
}

/* ---------- Smooth Scroll for Hash Navigation ---------- */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

.account-card:target {
    animation: highlightPulse 2s ease-out;
}

@keyframes highlightPulse {
    0%, 100% {
        box-shadow: var(--shadow);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.3), var(--shadow);
    }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .account-grid {
        gap: var(--space-md);
    }

    .account-card {
        padding: var(--space-md);
    }

    .account-card h2 {
        font-size: 1.3rem;
    }

    .account-card h3 {
        font-size: 1.1rem;
    }

    .two-col-grid {
        grid-template-columns: 1fr;
    }

    .profile-display {
        flex-direction: column;
        text-align: center;
        gap: var(--space-md);
    }

    .profile-info {
        align-items: center;
    }

    .profile-header-bg {
        padding: var(--space-lg) var(--space-md) var(--space-md);
    }
}

@media (max-width: 480px) {
    .account-container {
        padding: var(--space-md) 0;
    }

    .account-grid {
        padding: 0 10px;
    }

    .account-card {
        padding: var(--space-sm) var(--space-md);
    }

    .account-input,
    .account-select,
    .account-form-group input,
    .account-form-group select,
    .account-form-group textarea {
        font-size: 16px; /* Prevent iOS zoom */
    }

    .profile-photo,
    .profile-photo-placeholder {
        width: 100px;
        height: 100px;
    }

    .profile-name {
        font-size: 1.3rem;
    }
}
