/* Profile Page Styles */
:root {
    --primary-color: #4A00E0;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-color: #8E2DE2;
    --accent-color: #FF6B6B;
    --success-color: #4ECDC4;
    --warning-color: #FFE66D;
    --error-color: #FF6B6B;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --background-color: #f8fafc;
    --white: #ffffff;
    --light-gray: #f1f3f4;
    --border-color: #e1e8ed;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-heavy: 0 20px 40px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    direction: rtl;
}

/* Navigation */
.navbar {
    background: var(--white);
    padding: 1rem 0;
    box-shadow: var(--shadow-light);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-back, .btn-logout {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-back {
    background: var(--light-gray);
    color: var(--text-primary);
}

.btn-back:hover {
    background: var(--border-color);
    transform: translateY(-1px);
}

.btn-logout {
    background: var(--error-color);
    color: var(--white);
}

.btn-logout:hover {
    background: #e55656;
    transform: translateY(-1px);
}

/* Profile Container */
.profile-container {
    display: flex;
    max-width: 1200px;
    margin: 80px auto 2rem;
    padding: 0 2rem;
    gap: 2rem;
    min-height: calc(100vh - 120px);
}

/* Sidebar */
.profile-sidebar {
    width: 300px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    padding: 2rem;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.profile-avatar-section {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.avatar-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 1rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-color);
    background: var(--primary-gradient);
}

.avatar-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    cursor: pointer;
    color: var(--white);
    font-size: 0.8rem;
}

.avatar-wrapper:hover .avatar-upload-overlay {
    opacity: 1;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.profile-role {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.profile-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
}

.status-indicator.active {
    background: var(--success-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Navigation Menu */
.profile-nav {
    margin-top: 1rem;
}

.nav-list {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.nav-item:hover {
    background: var(--light-gray);
    color: var(--primary-color);
    transform: translateX(-5px);
}

.nav-item.active {
    background: var(--primary-gradient);
    color: var(--white);
    box-shadow: var(--shadow-medium);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.profile-main {
    flex: 1;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    overflow: hidden;
}

.profile-section {
    display: none;
    padding: 2rem;
}

.profile-section.active {
    display: block;
}

.section-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.section-title i {
    color: var(--primary-color);
}

.section-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Forms */
.profile-form {
    max-width: 100%;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    position: relative;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--white);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 0, 224, 0.1);
}

.field-icon {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.form-group label + input + .field-icon {
    top: calc(50% + 12px);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--white);
    box-shadow: var(--shadow-medium);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.btn-secondary {
    background: var(--light-gray);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* Security Section */
.security-card {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
}

.form-group label + input + .field-icon + .password-toggle {
    top: calc(50% + 12px);
}

/* Password Strength */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.strength-fill {
    height: 100%;
    width: 0%;
    background: var(--error-color);
    transition: var(--transition);
}

.strength-fill.weak {
    width: 33%;
    background: var(--error-color);
}

.strength-fill.medium {
    width: 66%;
    background: var(--warning-color);
}

.strength-fill.strong {
    width: 100%;
    background: var(--success-color);
}

.strength-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Two Factor Authentication */
.two-factor-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.feature-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.feature-icon {
    font-size: 2rem;
    color: var(--primary-color);
}

.feature-text h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.feature-text p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
}

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

.toggle-label {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    cursor: pointer;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    border-radius: 24px;
    transition: var(--transition);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    right: 3px;
    bottom: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: var(--transition);
}

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

input:checked + .toggle-label .toggle-slider:before {
    transform: translateX(-26px);
}

/* Sessions List */
.sessions-list {
    margin-top: 1rem;
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
}

.session-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.session-device {
    font-weight: 600;
    color: var(--text-primary);
}

.session-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.session-current {
    background: var(--success-color);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Preferences */
.preferences-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.preference-card {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.preference-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.preference-header i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.preference-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Theme Options */
.theme-options {
    display: flex;
    gap: 1rem;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.theme-preview {
    width: 40px;
    height: 30px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.theme-preview.light {
    background: linear-gradient(to bottom, var(--white) 50%, var(--light-gray) 50%);
}

.theme-preview.dark {
    background: linear-gradient(to bottom, #2c3e50 50%, #34495e 50%);
}

.theme-preview.auto {
    background: linear-gradient(45deg, var(--white) 50%, #2c3e50 50%);
}

.theme-option input:checked + .theme-preview {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 0, 224, 0.2);
}

.theme-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Privacy Options */
.privacy-option {
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    transition: var(--transition);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label input:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input:checked + .checkmark:after {
    display: block;
}

/* Activity Timeline */
.activity-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
}

.activity-filters select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--white);
}

.activity-timeline {
    position: relative;
}

.activity-timeline:before {
    content: "";
    position: absolute;
    right: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.activity-item {
    position: relative;
    padding: 1rem 0;
    padding-right: 3rem;
    margin-bottom: 1rem;
}

.activity-item:before {
    content: "";
    position: absolute;
    right: 14px;
    top: 1.5rem;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 3px solid var(--white);
    box-shadow: 0 0 0 2px var(--border-color);
}

.activity-content {
    background: var(--white);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.activity-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.activity-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.activity-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Notifications */
.notifications-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}

.notification-category {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.notification-category h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.notification-option {
    margin-bottom: 1rem;
}

.toggle-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.toggle-option input {
    display: none;
}

.toggle-option .toggle-slider {
    width: 40px;
    height: 20px;
    background: var(--border-color);
    border-radius: 20px;
    position: relative;
    transition: var(--transition);
}

.toggle-option .toggle-slider:before {
    content: "";
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: var(--white);
    border-radius: 50%;
    transition: var(--transition);
}

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

.toggle-option input:checked + .toggle-slider:before {
    transform: translateX(-20px);
}

.option-text {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Toast Notifications */
.notification-toast {
    position: fixed;
    top: 100px;
    left: 20px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    padding: 1rem 1.5rem;
    display: none;
    align-items: center;
    gap: 1rem;
    z-index: 1001;
    min-width: 300px;
    transform: translateX(-100%);
    transition: var(--transition);
}

.notification-toast.show {
    display: flex;
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.toast-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--white);
}

.toast-icon.success {
    background: var(--success-color);
}

.toast-icon.error {
    background: var(--error-color);
}

.toast-icon.warning {
    background: var(--warning-color);
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
}

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

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

.loading-spinner {
    text-align: center;
}

.spinner-circle {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .profile-container {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .profile-sidebar {
        width: 100%;
        position: static;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .preferences-grid {
        grid-template-columns: 1fr;
    }
    
    .theme-options {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .profile-container {
        margin: 70px auto 1rem;
        padding: 0 1rem;
    }
    
    .nav-container {
        padding: 0 1rem;
    }
    
    .nav-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-back, .btn-logout {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .profile-sidebar {
        padding: 1.5rem;
    }
    
    .profile-section {
        padding: 1.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .form-grid {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .profile-container {
        margin: 120px auto 1rem;
    }
    
    .profile-sidebar {
        padding: 1rem;
    }
    
    .profile-section {
        padding: 1rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .notification-toast {
        left: 10px;
        right: 10px;
        min-width: auto;
    }
}
