
/* --- LOADING OVERLAY --- */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Stay on top of everything */
    transition: opacity 0.5s ease, visibility 0.5s;
}

/* THE SPINNER ANIMATION */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff; /* UttamHub Blue */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading-overlay p {
    font-family: sans-serif;
    color: #555;
    font-weight: 500;
}

/* Utility to hide the spinner */
.loader-hidden {
    opacity: 0;
    visibility: hidden;
}

/* --- Global & Container --- */

.prf-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    background-color: #f9f9f9;
}

/* --- Back Link Button --- */
.back-link {
    align-self: flex-start;
    margin-bottom: 20px;
    background: none;
    border: none;
    color: #555555;
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-link:hover {
    color: #000000;
}

/* --- Authentication Card --- */
.auth-box {
    background-color: #ffffff;
    width: 100%;
    max-width: 450px;
    padding: 35px;
    border-radius: 12px;
    border: 1px solid #dddddd;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

/* --- Headings --- */
h2 {
    margin-top: 0;
    font-size: 1.6rem;
    color: #111111;
    margin-bottom: 25px;
    font-weight: 600;
}

/* --- Form Elements --- */
.input-group {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
}

.input-row {
    display: flex;
    gap: 15px;
}

.input-row .input-group {
    flex: 1;
}

label {
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 6px;
    color: #333333;
}

input {
    padding: 12px;
    border: 1px solid #bbbbbb;
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    transition: border 0.3s ease, box-shadow 0.3s ease;
}

input:focus {
    border-color: #0084ff;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 132, 255, 0.2);
}

/* --- Action Links & Help Text --- */
.form-help {
    text-align: right;
    margin-top: -10px;
    margin-bottom: 20px;
}

.text-link {
    color: #0084ff;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: text-decoration 0.3s ease;
}

.text-link:hover {
    text-decoration: underline;
}

/* --- Buttons --- */
.btn-main {
    width: 100%;
    padding: 14px;
    background-color: #0084ff;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-main:hover {
    background-color: #006dd4;
}

/* --- Google Button --- */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-google:active {
    background: #f1f1f1; /* Visual feedback on mobile tap */
}

.btn-google img {
    width: 18px;
    height: 18px;
}

.btn-google:hover {
    background-color: #f1f1f1;
}

/* --- Visual Divider --- */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 25px 0;
    color: #777777;
    font-size: 0.8rem;
}

.divider::before, 
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #dddddd;
}

.divider span {
    padding: 0 10px;
}

/* --- Footer Switch Text --- */
.switch-text {
    text-align: center;
    margin-top: 25px;
    font-size: 0.9rem;
    color: #555555;
}

/* Keep inputs side-by-side on desktop, stack on mobile */
.input-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.auth-box {
    width: 100%;
    max-width: 450px;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    /* Allow scrolling on short mobile screens */
    max-height: 90vh; 
    overflow-y: auto; 
}

@media (max-width: 600px) {
    .input-row {
        flex-direction: column;
        gap: 0; /* Let input-group margins handle spacing */
    }
    
    /* Make the auth box scrollable if it's too tall for the screen */
    .auth-box {
        max-height: 90vh;
        overflow-y: auto;
        padding-right: 10px;
    }
}

/* --- Utility --- */
.hidden {
    display: none !important;
}

/* --- Responsive Media Queries --- */

/* Tablet View (up to 768px) */
@media screen and (max-width: 768px) {
    .auth-box {
        max-width: 90%;
        padding: 25px;
    }
}

/* Mobile View (up to 480px) */
@media screen and (max-width: 480px) {
    .input-row {
        flex-direction: column;
        gap: 0;
    }
    
    .auth-box {
        padding: 20px;
        border: none;
        box-shadow: none;
        background: transparent;
    }
    
    .prf-wrapper {
        background-color: #ffffff;
        justify-content: flex-start;
    }
}

/* TV View (Large Screens 2500px+) */
@media screen and (min-width: 2500px) {
    .auth-box {
        max-width: 600px;
        padding: 50px;
    }
    
    input, .btn-main, .btn-google {
        font-size: 1.5rem;
        padding: 20px;
    }
    
    h2 {
        font-size: 2.5rem;
    }
}

/* --- DASHBOARD MAIN CONTAINER --- */
.profile-page {
    display: flex;
    min-height: 100vh;
    background-color: #f4f7f6;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
@media (max-width: 768px) {
    .profile-page {
        flex-direction: column; /* Stack sidebar on top of content for mobile */
    }
}

/* --- SIDEBAR NAVIGATION --- */
/* --- SIDEBAR CONTAINER --- */
.profile-sidebar {
    width: 280px;
    background-color: #ffffff;
    border-right: 1px solid #e0e0e0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box; /* CRITICAL: Ensures padding doesn't increase width */
}
@media (max-width: 768px) {
    .profile-sidebar {
        width: 100%; 
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        /* Equalize padding on all sides to prevent "right-side" lean */
        padding: 15px; 
        margin: 0; 
        box-sizing: border-box; 
    }
}

/* --- THE PARENT CONTAINER (Check this!) --- */
.profile-page {
    display: flex;
    margin: 0;
    padding: 0;
}
@media (max-width: 768px) {
    .profile-page {
        flex-direction: column;
        align-items: center; /* Ensures children don't lean to one side */
        width: 100%;
    }
}

/* --- SIDEBAR CONTENT SPACING --- */
.profile-sidebar > * {
    max-width: 100%;
    width: 100%; /* Forces internal elements to use full width */
}
@media (max-width: 768px) {
    .profile-sidebar {
        align-items: stretch; 
        /* Reset any potential left shift */
        left: 0; 
    }
}

/* --- SIDEBAR HEADER (Avatar & Name) --- */
.sidebar-header {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 20px;
}
.sidebar-header img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #007bff;
    margin-bottom: 10px;
}
.sidebar-header h3 {
    font-size: 1.2rem;
    color: #333;
    margin: 0;
}
@media (max-width: 768px) {
    .sidebar-header {
        display: flex;
        align-items: center;
        text-align: left;
        padding: 10px 0;
        margin-bottom: 10px;
    }
    .sidebar-header img {
        width: 50px;
        height: 50px;
        margin-bottom: 0;
        margin-right: 15px;
    }
}

/* --- NAVIGATION BUTTONS --- */
/* --- SIDEBAR NAVIGATION (Container) --- */
.sidebar-nav {
    display: flex;
    flex-direction: column; /* Stays vertical on all screens */
    gap: 8px;
}
@media (max-width: 768px) {
    .sidebar-nav {
        gap: 5px; /* Slightly tighter gap on mobile */
        padding: 0;
    }
}

/* --- NAVIGATION BUTTONS --- */
.nav-btn {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border: none;
    background: transparent;
    color: #555;
    cursor: pointer;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%; /* Ensures button takes full width of sidebar */
}
@media (max-width: 768px) {
    .nav-btn {
        padding: 14px 12px; /* Larger padding for easier finger tapping on mobile */
        font-size: 0.95rem;
        border-bottom: 1px solid #f0f0f0; /* Subtle separator for mobile list style */
        border-radius: 0; /* Optional: square edges look cleaner in a mobile list */
    }
}

/* --- BUTTON ICONS --- */
.nav-btn i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}
@media (max-width: 768px) {
    .nav-btn i {
        margin-right: 15px; /* More space for icons on mobile */
        font-size: 1.1rem;
    }
}

/* --- HOVER STATE --- */
.nav-btn:hover {
    background-color: #f0f4f8;
    color: #007bff;
}

/* --- ACTIVE STATE --- */
.nav-btn.active {
    background-color: #007bff;
    color: #ffffff;
}
@media (max-width: 768px) {
    .nav-btn.active {
        border-bottom: 1px solid #007bff; /* Keep active button looking seamless */
    }
}

/* --- LOGOUT & BACK BUTTONS --- */
.btn-logout-sidebar, .btn-back {
    margin-top: 10px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
}
.btn-logout-sidebar {
    background-color: #fff0f0;
    color: #d9534f;
}
.btn-back {
    background-color: #e9ecef;
    color: #495057;
}
@media (max-width: 768px) {
    .btn-logout-sidebar, .btn-back {
        margin-top: 0;
        padding: 10px;
    }
}

/* --- MAIN CONTENT AREA --- */
.profile-content {
    flex: 1;
    padding: 40px;
    max-width: 900px;
}
@media (max-width: 768px) {
    .profile-content {
        padding: 20px;
    }
}

/* --- SECTION CARD STYLING --- */
.profile-section {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.profile-section h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: #222;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

/* --- FORM GROUPS & INPUTS --- */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #666;
}
.form-row {
    display: flex;
    gap: 15px;
}
input[type="text"], input[type="tel"], input[type="email"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}
@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
}

/* --- PRIMARY ACTION BUTTONS --- */
.btn-primary {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    width: fit-content;
    transition: background 0.2s;
}
.btn-primary:hover {
    background-color: #0056b3;
}
@media (max-width: 600px) {
    .btn-primary {
        width: 100%; /* Full width button on small phones */
    }
}

/* --- UTILS --- */
.hidden {
    display: none !important;
}
.empty-msg {
    text-align: center;
    color: #999;
    padding: 40px 0;
}

/* --- PROFILE FORM CONTAINER --- */
/* --- 1. Main Form Container --- */
.edit-profile-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* --- 2. Form Group (Label + Input Wrapper) --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* --- 3. Labels --- */
.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

/* --- 4. Inputs and Select Dropdowns --- */
.edit-profile-form input, 
.edit-profile-form select {
    padding: 12px 15px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
    background-color: #fff;
    box-sizing: border-box; /* Critical for responsiveness */
    transition: border-color 0.2s, box-shadow 0.2s;
}

.edit-profile-form input:focus, 
.edit-profile-form select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Specific styling for the Read-Only Username */
#p-username {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* --- 5. Flexible Rows --- */
.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Default for Desktop/TV */
    gap: 15px;
    width: 100%;
}

/* Media Query for form-row: Tablet & Mobile */
@media screen and (max-width: 1024px) {
    .form-row {
        grid-template-columns: repeat(2, 1fr); /* 2 columns for Tablets */
    }
}

@media screen and (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr; /* 1 column for Mobile */
    }
}

/* --- 6. The Submit Button --- */
.btn-primary {
    background-color: #007bff;
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    width: fit-content;
    margin-top: 10px;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Media Query for Button: Mobile */
@media screen and (max-width: 600px) {
    .btn-primary {
        width: 100%; /* Easy to tap on phone */
        padding: 16px;
    }
}

/* --- 7. TV Specific Optimizations --- */
@media screen and (min-width: 2000px) {
    .edit-profile-form {
        max-width: 1200px; /* Wider layout for TV */
    }
    .form-group label, .edit-profile-form input, .btn-primary {
        font-size: 1.5rem; /* Larger text for viewing from a distance */
    }
}

/* --- Address Form Container --- */
.address-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
}

/* --- Standard Two-Column Row --- */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
/* Media for Two-Column Row */
@media screen and (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr; /* Stacks on mobile */
    }
}

/* --- Triple-Column Row (City/State/Pin) --- */
.form-row-triple {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
}
/* Media for Triple-Column Row */
@media screen and (max-width: 768px) {
    .form-row-triple {
        grid-template-columns: 1fr 1fr; /* 2 columns on tablet */
    }
}
@media screen and (max-width: 480px) {
    .form-row-triple {
        grid-template-columns: 1fr; /* 1 column on small phones */
    }
}

/* --- Input Styling (Shared with Profile) --- */
.address-form input {
    padding: 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.2s;
}
.address-form input:focus {
    border-color: #007bff;
    outline: none;
    background-color: #fff;
}

/* --- TV View Optimization --- */
@media screen and (min-width: 2000px) {
    .address-form {
        max-width: 1400px;
    }
    .address-form input {
        font-size: 1.4rem;
        padding: 20px;
    }
}