@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

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

:root {
    --bg-primary: #212121;
    --bg-secondary: #2f2f2f;
    --bg-tertiary: #3d3d3d;
    --text-primary: #ececec;
    --text-secondary: #b4b4b4;
    --border: #3d3d3d;
    --accent: #d4af37;
    --accent-hover: #b8941f;
    --sidebar-bg: #0f0f0f;
    --sidebar-text: #ececec;
    --sidebar-border: #2a2a2a;
}

body {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    direction: rtl;
}

.settings-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    animation: fadeIn 0.5s ease-out;
}

/* Page Load Animation - نفس انيميشن صفحة تسجيل الدخول تماماً */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* إزالة الانيميشن الأخرى لتجنب التعارض */

/* Sidebar - نفس تصميم التطبيق الرئيسي */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0f0f0f 0%, #1a1a1a 100%);
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    border-left: 1px solid #2a2a2a;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.logo-container {
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-container h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--sidebar-text);
    letter-spacing: -0.5px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.4));
}

.back-btn-container {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8e8e8e;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.back-btn-container:hover {
    background: rgba(212, 175, 55, 0.1);
    color: #d4af37;
    transform: rotate(-90deg);
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--sidebar-text);
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(212, 175, 55, 0.05);
    transform: translateX(-3px);
}

.nav-item.active {
    background: rgba(212, 175, 55, 0.1);
}

.nav-item i {
    font-size: 0.875rem;
    color: #8e8e8e;
}

.nav-item span {
    font-size: 0.875rem;
    color: var(--sidebar-text);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.settings-header {
    padding: 2rem 2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.settings-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

.settings-header p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.settings-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.settings-section {
    margin-bottom: 2rem;
}

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

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.section-title i {
    font-size: 1.25rem;
    color: var(--accent);
}

.section-title h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-title.danger i,
.section-title.danger h2 {
    color: #dc2626;
}

.profile-picture-section {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.profile-picture-container {
    position: relative;
}

.profile-picture {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37 0%, #f4d03f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
    overflow: hidden;
    border: 4px solid var(--bg-primary);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
}

.profile-picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-picture-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 40px;
    background: var(--accent);
    border: 3px solid var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-picture-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

.profile-picture-info {
    flex: 1;
}

.profile-picture-info h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.profile-picture-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.remove-picture-btn {
    background: transparent;
    border: 1px solid #dc2626;
    color: #dc2626;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.remove-picture-btn:hover {
    background: #dc2626;
    color: white;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.setting-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.setting-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent) 0%, #f4d03f 100%);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.setting-card:hover::before {
    transform: scaleX(1);
}

.setting-card:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(212, 175, 55, 0.15);
    transform: translateY(-4px);
}

.card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(244, 208, 63, 0.1) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--accent);
    flex-shrink: 0;
}

.card-icon.premium {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.1) 0%, rgba(251, 191, 36, 0.1) 100%);
    color: #eab308;
}

.card-content {
    flex: 1;
    min-width: 0;
}

.card-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch input {
    display: none;
}

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

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--bg-primary);
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

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

.model-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    font-family: inherit;
    color: var(--text-primary);
    transition: all 0.2s;
}

.model-select:hover {
    background: var(--bg-tertiary);
}

.model-select:focus {
    border-color: var(--accent);
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s;
}

.stat-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.1);
    transform: translateY(-2px);
}

.stat-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #d4af37 0%, #f4d03f 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.danger-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border);
}

.danger-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.danger-card {
    background: var(--bg-primary);
    border: 2px solid rgba(220, 38, 38, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    transition: all 0.3s;
}

.danger-card:hover {
    border-color: rgba(220, 38, 38, 0.4);
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.1);
}

.danger-card.logout-card {
    border-color: rgba(212, 175, 55, 0.2);
}

.danger-card.logout-card:hover {
    border-color: rgba(212, 175, 55, 0.4);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.1);
}

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

.danger-icon {
    width: 48px;
    height: 48px;
    background: rgba(220, 38, 38, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #dc2626;
    flex-shrink: 0;
}

.danger-icon.logout {
    background: rgba(212, 175, 55, 0.1);
    color: var(--accent);
}

.danger-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.danger-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.danger-btn {
    background: transparent;
    border: 2px solid #dc2626;
    color: #dc2626;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.danger-btn:hover {
    background: #dc2626;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.logout-btn {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.logout-btn:hover {
    background: var(--accent);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

/* Scrollbar */
.main-content::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
    background: #d1d1d1;
    border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: #b1b1b1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .profile-picture-section {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }
    
    .profile-picture-info {
        width: 100%;
    }
    
    .remove-picture-btn {
        width: 100%;
        justify-content: center;
    }
    
    .settings-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-left: none;
        border-bottom: 1px solid var(--sidebar-border);
    }
    
    .logo-container {
        padding: 0.75rem 1rem;
    }
    
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        padding: 0.5rem;
    }
    
    .nav-item {
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    .settings-header {
        padding: 1.5rem 1rem 1rem;
    }
    
    .settings-header h1 {
        font-size: 1.5rem;
    }
    
    .settings-header p {
        font-size: 0.875rem;
    }
    
    .settings-content {
        padding: 1rem;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .setting-card,
    .stat-card {
        padding: 1.25rem;
    }
    
    .danger-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .danger-btn,
    .logout-btn {
        width: 100%;
        justify-content: center;
    }
}



/* Ripple Effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Enhanced transitions */
.setting-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item {
    transition: all 0.2s ease;
}

.back-btn-container {
    transition: all 0.2s ease;
}

/* Focus states */
.setting-item:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.model-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

/* Loading states */
.setting-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.setting-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}



/* Print styles */
@media print {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin: 0;
    }
    
    .setting-item {
        break-inside: avoid;
    }
    
    .danger-btn,
    .toggle-switch,
    .model-select {
        display: none;
    }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

/* Enhanced button styles */
button, .nav-item {
    position: relative;
    overflow: hidden;
    outline: none;
}

button:focus, .nav-item:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Smooth transitions for theme switching */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Enhanced hover effects */
.setting-item {
    position: relative;
    overflow: hidden;
}

.setting-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.1), transparent);
    transition: left 0.5s ease;
}

.setting-item:hover::before {
    left: 100%;
}

/* Loading animation for settings */
.setting-item.processing {
    pointer-events: none;
    opacity: 0.7;
}

.setting-item.processing .setting-info {
    filter: blur(1px);
}

/* Keyboard navigation support */
.setting-item:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
    z-index: 1;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .setting-item {
        border-width: 2px;
    }
    
    .toggle-slider {
        border: 2px solid var(--text-primary);
    }
    
    .danger-btn {
        border-width: 2px;
    }
}

/* Focus visible for better keyboard navigation */
.nav-item:focus-visible,
button:focus-visible,
.back-btn-container:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Mobile touch improvements */
@media (hover: none) and (pointer: coarse) {
    .setting-item:hover {
        transform: none;
    }
    
    .setting-item:active {
        transform: scale(0.98);
    }
    
    button:active,
    .nav-item:active {
        transform: scale(0.95);
    }
}
