/* Profile page styles */
/* --- Dark Mode Overrides for Profile Page --- */

[data-theme="dark"] .profile-header,
[data-theme="dark"] .profile-stats,
[data-theme="dark"] .profile-content,
[data-theme="dark"] .section-card,
[data-theme="dark"] .settings-group,
[data-theme="dark"] .bio-section {
    /* * 1. Set Background to Dark:
     * We assume you've already mapped --bg-white in dashboard.css to a dark color. 
     * If not, this is a fallback:
     */
    background-color: var(--bg-white); 
    
    /* * 2. Set Text to White: 
     * This ensures all text within these main containers is visible.
     */
    color: var(--text-dark); 
}

/* * 3. Ensure Headings are White: 
 * Target headings explicitly as they might have specific color rules.
 */
[data-theme="dark"] .profile-content h3,
[data-theme="dark"] .profile-header h2,
[data-theme="dark"] .profile-content h4 {
    color: var(--text-dark); 
}

/* * 4. Fix Profile Stats Text: 
 * These often use both primary (value) and secondary (label) text colors.
 */
[data-theme="dark"] .stat-item h4 {
    color: var(--text-dark); /* Stat Value (e.g., Number of Quizzes) */
}

[data-theme="dark"] .stat-item p {
    color: var(--text-medium); /* Stat Label (e.g., "Quizzes Taken") */
}

/* My Content Tab Buttons (Quizzes/Posts) */

/* Default state for dark theme */
[data-theme="dark"] .content-tab {
    background-color: var(--bg-medium); /* Darker background */
    color: var(--text-dark); /* Light text on dark button */
}

/* Active state for dark theme */
[data-theme="dark"] .content-tab.active {
    background-color: var(--primary-color-dark); /* Use a darker variant of primary color for a smoother look */
    color: white;
}

/* Filtering Select Box (e.g., 'All Quizzes') */
.content-actions select {
    /* Apply base styling for all themes */
    padding: var(--space-2) var(--space-3); /* Adjust padding to be similar to button */
    border: 1px solid var(--border-medium);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    max-width: 150px; /* Constrain max width for better responsive control */
    min-width: 120px;
}

/* Dark Mode Override for the Select Box */
[data-theme="dark"] .content-actions select {
    background-color: var(--bg-medium); /* Use a dark background */
    color: var(--text-dark); /* Ensure text is light/white */
    border-color: var(--border-dark); /* Darker border for contrast */
}

/* Responsive Fix for select box and actions */
/* Note: You already have .content-actions flex-direction: column on max-width: 768px */
/* Ensure the filter is styled to not span full width when it shouldn't */
@media (max-width: 768px) {
    .content-actions {
        flex-direction: column;
        gap: var(--space-2);
    }
    .content-actions button,
    .content-actions select {
        width: 100%; /* Make them full-width in mobile view */
        max-width: none;
    }
}


/* Profile Header */
.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-6);
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.profile-avatar-container {
    position: relative;
    margin-bottom: var(--space-4);
}

.profile-avatar {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-edit {
    position: absolute;
    bottom: 15px; /* Adjusted to show outside the circle */
    right: 14px;  /* Adjusted to show outside the circle */
    background-color: var(--primary-color);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.avatar-edit input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.profile-details h2 {
    margin-bottom: var(--space-1);
    font-size: var(--text-2xl);
}

.profile-details p {
    color: var(--text-medium);
    margin-bottom: var(--space-4);
}

.profile-stats {
    display: flex;
    gap: var(--space-6);
    justify-content: center;
    margin-top: var(--space-4);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-dark);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-medium);
}

/* Tabs Navigation */
.profile-tab-container {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}

.profile-tabs::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.tab-btn {
    padding: var(--space-4) var(--space-6);
    background: none;
    border: none;
    font-weight: 500;
    color: var(--text-medium);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
}

.tab-content {
    display: none;
    padding: var(--space-6);
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Form Styles */
.profile-form {
    max-width: 600px;
}

.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius);
    font-size: var(--text-base);
}

.form-group input:disabled {
    background-color: var(--bg-light);
    cursor: not-allowed;
}

.form-group small {
    display: block;
    margin-top: var(--space-1);
    color: var(--text-light);
    font-size: var(--text-xs);
}

.help-text {
    margin-bottom: var(--space-4);
    color: var(--text-medium);
    font-size: var(--text-sm);
}

/* Content Sections */
.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    gap: var(--space-4);
}
/* --- 1. Content Tabs (Segmented Control Group) --- */
.content-tabs {
    display: flex;
    border: 1px solid gray; 
    border-radius: var(--radius);
    overflow: hidden; 
    /* Adjust margin to align with the select box below if needed */
    margin-top: 0;
}

.content-tab {
    background-color: var(--bg-light); /* Base light background */
    border: none;
    border-radius: 0; 
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-medium);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.content-tab:not(:last-child) {
    border-right: 1px solid var(--border-medium); /* Separator */
}

.content-tab.active {
    background-color: var(--primary-color);
    color: white;
}

/* --- Dark Mode Overrides for Tabs --- */
[data-theme="dark"] .content-tabs {
    border-color: var(--border-dark); 
}

[data-theme="dark"] .content-tab {
    background-color: var(--bg-medium); /* Darker non-active background */
    color: var(--text-medium);
}

[data-theme="dark"] .content-tab:not(:last-child) {
    border-right-color: var(--border-dark);
}

[data-theme="dark"] .content-tab.active {
    background-color: var(--primary-color); /* Primary color for active state */
    color: white;
    /* Optional: Add a slight shadow for premium feel */
    box-shadow: 0 1px 6px rgba(var(--primary-rgb), 0.3);
}

.content-tab.active {
    background-color: var(--primary-color);
    color: white;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.content-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.user-content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}

.content-card {
    background-color: var(--bg-light);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-light);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.content-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.content-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
}

.content-card-header h4 {
    margin: 0;
    font-size: var(--text-base);
}

.status-badge {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius);
}

.status-badge.pending {
    background-color: var(--warning-light);
    color: var(--warning);
}

.status-badge.private {
    background-color: var(--bg-light);
    color: var(--text-medium);
}

.status-badge.public {
    background-color: var(--success-light);
    color: var(--success);
}

.content-card-body {
    padding: var(--space-4);
}

.content-card-body p {
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-medium);
}

.content-meta {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--text-light);
}

.content-card-actions {
    display: flex;
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border-light);
    gap: var(--space-2);
    background-color: var(--bg-white);
}

/* Danger Zone */
.danger-zone {
    background-color: var(--error-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.danger-zone h3 {
    color: var(--error);
    margin-bottom: var(--space-2);
}

.danger-zone p {
    margin-bottom: var(--space-4);
    color: var(--text-medium);
}

.danger-btn {
    background-color: var(--error);
    color: white;
    border: none;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.danger-btn:hover {
    background-color: var(--error-dark);
}

/* Small Button Variant */
.btn-sm {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
}

/* Image Upload Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--bg-white);
    margin: 10% auto;
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    width: 80%;
    max-width: 500px;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    font-size: var(--text-xl);
    cursor: pointer;
}

.image-preview-container {
    width: 100%;
    height: 300px;
    margin: var(--space-4) 0;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius);
    overflow: hidden;
}

#image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-controls {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
}

/* Loading/Empty States */
.loading-container, .no-access-message, .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    text-align: center;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid var(--primary-color);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-4);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state i, .no-access-message i {
    font-size: 48px;
    color: var(--text-light);
    margin-bottom: var(--space-4);
}

.loading-spinner {
    text-align: center;
    color: var(--text-medium);
    padding: var(--space-8);
}

.loading-spinner i {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
}

/* Error message styling */
.error-message {
    background-color: var(--error-light);
    color: var(--error);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    text-align: center;
    margin: var(--space-8) 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.error-message i {
    font-size: 48px;
    margin-bottom: var(--space-4);
}

.error-message h3 {
    margin-bottom: var(--space-3);
    font-size: var(--text-xl);
}

.error-message p {
    margin-bottom: var(--space-5);
    color: var(--text-dark);
}

.error-message button {
    margin-top: var(--space-2);
}

/* Language Notification */
.language-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--primary-color);
    color: white;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease, slideOut 0.3s ease 2.7s forwards;
    z-index: 1000;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideOut {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

/* Responsive Adjustments */
@media (min-width: 768px) {
    .profile-header {
        flex-direction: row;
        text-align: left;
    }
    
    .profile-avatar-container {
        margin-right: var(--space-6);
        margin-bottom: 0;
    }
    
    .profile-stats {
        justify-content: flex-start;
        margin-top: var(--space-2);
    }
}

@media (max-width: 768px) {
    .tab-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .content-actions {
        flex-direction: column;
        gap: var(--space-2);
    }
    
    .user-content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .profile-stats {
        gap: var(--space-4);
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
}

/* Profile Photo Preview Styles */
.photo-preview, 
.profile-photo-preview,
#photo-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: #f1f5f9;
    border: 2px solid #e2e8f0;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.photo-upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Style for when image is previewed */
.has-preview {
    background-size: cover;
    background-position: center;
}

.hidden-file-input {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.help-text {
    font-size: var(--text-xs);
    color: var(--text-medium);
}
.profile-photo-preview.has-preview .placeholder-text {
    display: none;
}

.photo-upload-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.hidden-file-input {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.help-text {
    font-size: var(--text-xs);
    color: var(--text-medium);
}

/* Danger button base */
.danger-btn {
    background-color: #e53935;
    color: white;
    transition: background 0.2s ease;
}

/* Hover in DARK MODE */
.dark-theme .danger-btn:hover {
    background-color: #ff4444; /* bright red for dark mode */
}

/* Hover in LIGHT MODE */
.light-theme .danger-btn:hover {
    background-color: #c62828 !important; /* darker red for light mode */
}

/* profile.css */

.form-group input,
.form-group select,
.form-group textarea { /* <-- STEP 1: Include textarea */
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius);
    font-size: var(--text-base);
    
    /* Ensure a clean white background in Light Mode for all fields */
    background-color: var(--bg-white); 
    color: var(--text-dark);
}

.form-group input:disabled,
.form-group textarea:disabled { 
    background-color: var(--bg-light);
    cursor: not-allowed;
}

/* ... rest of the file ... */

/* profile.css */

/* --- Dark Mode Override for ALL Form Blanks (Input, Select, Textarea) --- */
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea { /* <-- STEP 2: Apply to all form blanks */
    /* Use the variable confirmed for input-like elements in dark mode */
    background-color: rgb(12, 26, 41); 
    
    /* Text color for readability in dark mode */
    color: var(--text-dark); 
    
    /* Darker border for contrast */
    border-color: rgb(65, 65, 65); 
}


/* =========================================
   MOBILE LOGOUT & SPACING FIXES
   ========================================= */

/* Default: Hide the extra logout button on desktop */
.mobile-logout-container {
    display: none;
}

/* Mobile Styling (tablets and phones) */
@media (max-width: 992px) {
    
    /* 1. Show the Logout Button */
    .mobile-logout-container {
        display: block;
        margin-top: var(--space-6);
        margin-bottom: var(--space-8); /* Extra space at bottom for mobile nav */
        padding-top: var(--space-6);
        border-top: 1px solid var(--border-light);
    }

    .mobile-logout-container .btn {
        width: 100%; /* Make button full width */
        justify-content: center;
        padding: 12px;
        font-weight: 600;
        border-color: var(--border-medium);
        color: var(--text-dark);
        background-color: var(--bg-white);
    }

    /* Dark mode support for the button */
    [data-theme="dark"] .mobile-logout-container .btn {
        background-color: var(--bg-light); 
        color: var(--text-light);
        border-color: var(--border-medium);
    }
    
    /* 2. FIX THE LARGE TOP GAP */
    
    /* Reduce the container padding on mobile */
    .main-content {
        /* Was originally padding-top: 64px + 2rem padding. Reducing top padding. */
        padding-top: 10px !important; /* Just enough to clear the fixed top bar */
        padding-left: var(--space-4) !important;
        padding-right: var(--space-4) !important;
    }

    /* Reduce the header margin */
    .main-content header {
        margin-bottom: var(--space-4) !important; /* Reduced from space-8 (32px) to space-4 (16px) */
    }

    /* Reduce the H1 margin */
    .main-content header h1 {
        font-size: 1.75rem; /* Slightly smaller font for mobile */
        margin-bottom: var(--space-1) !important;
    }
    
    /* Reduce gap between Profile Header Card and Tabs */
    .profile-header {
        margin-bottom: var(--space-4) !important;
        padding: var(--space-4) !important;
    }
}