/* --- PROFESSIONAL PROFILE & SETTINGS --- */
.profile-layout { display: flex; max-width: 1100px; margin: 40px auto; gap: 30px; padding: 0 20px; align-items: flex-start; }

.profile-sidebar { width: 300px; background: white; border-radius: 24px; padding: 30px 20px; box-shadow: var(--shadow-lg); border: 1px solid #E2E8F0; position: sticky; top: 100px; }
.profile-user-summary { text-align: center; border-bottom: 1px solid #F1F5F9; padding-bottom: 20px; margin-bottom: 20px; }
.profile-avatar { width: 90px; height: 90px; background: #F8FAFC; border-radius: 50%; margin: 0 auto 15px; display: flex; align-items: center; justify-content: center; font-size: 35px; color: var(--secondary); border: 3px solid #E2E8F0; }
.profile-user-summary h3 { font-size: 20px; font-weight: 800; color: var(--dark); margin: 0; }

.profile-nav { list-style: none; padding: 0; margin: 0; }
.profile-nav li { padding: 14px 20px; margin-bottom: 8px; border-radius: 12px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--secondary); display: flex; align-items: center; gap: 12px; transition: 0.3s; }
.profile-nav li i { font-size: 16px; width: 20px; text-align: center; }
.profile-nav li:hover { background: #F8FAFC; color: var(--primary); }
.profile-nav li.active { background: var(--primary); color: white; box-shadow: 0 4px 10px rgba(124, 58, 237, 0.2); }

.profile-content { flex: 1; min-width: 0; }
.profile-tab { display: none; background: white; border-radius: 24px; padding: 40px; box-shadow: var(--shadow-lg); border: 1px solid #E2E8F0; animation: fadeIn 0.3s ease-out; }
.profile-tab.active { display: block; }
.profile-section-title { font-size: 24px; font-weight: 800; color: var(--dark); margin-bottom: 25px; border-bottom: 2px solid #F1F5F9; padding-bottom: 15px; }

/* Dynamic Settings Cards */
.settings-group { margin-bottom: 30px; }
.settings-group h4 { font-size: 13px; font-weight: 800; color: var(--secondary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 15px; }
.settings-card { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 16px; padding: 20px; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; transition: 0.2s; }
.settings-card:hover { border-color: var(--primary-light); background: #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.02); }
.settings-info h5 { margin: 0 0 5px 0; font-size: 15px; color: var(--dark); }
.settings-info p { margin: 0; font-size: 12px; color: var(--secondary); }
.settings-action { display: flex; align-items: center; gap: 15px; }

/* Settings Switch Toggle */
.setting-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.setting-switch input { opacity: 0; width: 0; height: 0; }
.setting-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #CBD5E1; transition: .4s; border-radius: 34px; }
.setting-slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
.setting-switch input:checked + .setting-slider { background-color: var(--primary); }
.setting-switch input:checked + .setting-slider:before { transform: translateX(18px); }

/* 📱 MOBILE RESPONSIVE ADJUSTMENTS */
@media screen and (max-width: 768px) {
    /* 🟢 UPDATED: Changed top margin from 10px to 40px to safely clear the header */
    .profile-layout { flex-direction: column; padding: 10px 15px; margin: 40px auto 40px; gap: 20px; }
    
    .profile-sidebar { width: 100%; position: static; padding: 20px; border-radius: 20px; top: auto; z-index: 10; }
    
    /* Make User Profile a Row on Mobile to save space */
    .profile-user-summary { display: flex; align-items: center; text-align: left; gap: 15px; border-bottom: 1px solid #F1F5F9; padding-bottom: 15px; margin-bottom: 15px; }
    .profile-avatar { width: 60px; height: 60px; margin: 0; font-size: 24px; flex-shrink: 0; }
    .profile-user-summary h3 { font-size: 18px; }
    .profile-user-summary p { margin-bottom: 5px !important; }
    #profBadge { margin-bottom: 0; display: inline-block; }
    
    /* Make Navigation a Horizontal Swipeable Bar on Mobile */
    .profile-nav { display: flex; overflow-x: auto; gap: 10px; padding-bottom: 5px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
    .profile-nav::-webkit-scrollbar { display: none; } /* Hide scrollbar for a clean look */
    .profile-nav { -ms-overflow-style: none; scrollbar-width: none; }
    .profile-nav li { white-space: nowrap; flex: 0 0 auto; scroll-snap-align: start; margin-bottom: 0; padding: 10px 16px; font-size: 13px; }
    
    /* Content Adjustments */
    .profile-content { width: 100%; }
    .profile-tab { padding: 20px; border-radius: 20px; }
    .profile-section-title { font-size: 20px; margin-bottom: 20px; }
    
    /* Settings Card Adjustments */
    .settings-card { flex-direction: column; align-items: flex-start; gap: 15px; padding: 15px; }
    .settings-action { width: 100%; justify-content: flex-end; }
    
    /* History Card Adjustments */
    .history-card { flex-direction: column; align-items: flex-start; gap: 15px; padding: 15px; }
    .history-date-box { width: 100%; display: flex; gap: 10px; align-items: center; justify-content: center; padding: 8px; }
    .h-month { margin-top: 0; margin-left: 5px; }
    .history-info { width: 100%; }
    .h-price { align-self: flex-end; margin-top: -10px; }
}
/* =========================================
   GLOBAL BACK BUTTON & MOBILE FIXES
========================================= */
.global-back-btn {
    position: fixed;
    top: 90px;
    left: 20px;
    background: white;
    color: var(--dark);
    padding: 8px 16px;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    z-index: 900;
    transition: 0.2s;
    border: 1px solid #E2E8F0;
}
.global-back-btn:hover { 
    background: #F8FAFC; color: var(--primary); transform: translateX(-2px); 
}

/* 📱 MOBILE RESPONSIVE ADJUSTMENTS */
@media screen and (max-width: 768px) {
    .profile-layout { flex-direction: column; padding: 10px 15px; margin: 40px auto 40px; gap: 20px; }
    
    .profile-sidebar { width: 100%; position: static; padding: 20px; border-radius: 20px; top: auto; z-index: 10; }
    
    /* 🟢 FIX: User Profile Header is centered and stacked neatly */
    .profile-user-summary { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; border-bottom: 1px solid #F1F5F9; padding-bottom: 20px; margin-bottom: 20px; }
    .profile-avatar { width: 70px; height: 70px; margin: 0; font-size: 30px; flex-shrink: 0; }
    .profile-user-summary h3 { font-size: 22px; margin: 0; }
    .profile-user-summary p { margin: 0 0 10px 0 !important; font-size: 13px; }
    #profBadge { margin-bottom: 0; display: inline-block; }
    
    /* 🟢 FIX: Navigation is now a Vertical List (Matches your screenshot!) */
    .profile-nav { display: flex; flex-direction: column; overflow-x: visible; gap: 5px; padding-bottom: 0; }
    .profile-nav li { white-space: normal; width: 100%; padding: 14px 20px; font-size: 14px; margin-bottom: 0; justify-content: flex-start; }
    
    /* Content Adjustments */
    .profile-content { width: 100%; }
    .profile-tab { padding: 20px; border-radius: 20px; }
    .profile-section-title { font-size: 20px; margin-bottom: 20px; }
    
    /* Settings Card Adjustments */
    .settings-card { flex-direction: column; align-items: flex-start; gap: 15px; padding: 15px; }
    .settings-action { width: 100%; justify-content: flex-end; }
    
    /* History Card Adjustments */
    .history-card { flex-direction: column; align-items: flex-start; gap: 15px; padding: 15px; }
    .history-date-box { width: 100%; display: flex; gap: 10px; align-items: center; justify-content: center; padding: 8px; }
    .h-month { margin-top: 0; margin-left: 5px; }
    .history-info { width: 100%; }
    .h-price { align-self: flex-end; margin-top: -10px; }
}
