/* --- عام --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: linear-gradient(-45deg, #0f2027, #203a43, #2c5364, #0f2027);
    background-size: 400% 400%;
    animation: gradientBG 12s ease infinite;
    color: #fff;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Dashboard Container --- */
.dashboard-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

.dashboard-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2.5rem;
    color: #00c6ff;
}

.logo h1 {
    color: #fff;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.theme-toggle-btn {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 2px solid #ffc107;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.theme-toggle-btn:hover {
    background: rgba(255, 193, 7, 0.3);
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(255, 193, 7, 0.4);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #fff;
}

.user-info span {
    font-weight: 500;
    font-size: 1rem;
}

.logout-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #ff4757, #ff3742);
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

.logout-btn:hover {
    background: linear-gradient(135deg, #ff3742, #ff4757);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.6);
}

/* --- Courses Section --- */
.courses-section h2 {
    margin-bottom: 10px;
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.course-card {
    background: rgba(255,255,255,0.08);
    padding: 15px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    transition: transform 0.3s, box-shadow 0.3s;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.course-icon i {
    font-size: 2rem;
    margin-bottom: 10px;
}

.course-info h3 {
    margin-bottom: 5px;
}

.course-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-primary, .btn-secondary {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #556cd6;
}

.btn-secondary {
    background: #fff;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #e6e9f9;
}

/* --- Footer --- */
.dashboard-footer {
    text-align: center;
    padding: 15px 0;
    margin-top: 20px;
    background: rgba(0,0,0,0.5);
    border-radius: 10px;
}

/* --- Modals --- */
.course-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    color: #333;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 90%;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.modal-body pre {
    white-space: pre-wrap;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* --- Notifications --- */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1001;
    animation: slideInRight 0.3s ease-out;
}

.notification-success {
    border-left: 4px solid #28a745;
    color: #28a745;
}

.notification-info {
    border-left: 4px solid #17a2b8;
    color: #17a2b8;
}

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(50px); opacity:0; } to { transform: translateY(0); opacity:1; } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100px);} to { opacity:1; transform:translateX(0);} }
@keyframes slideOutRight { from { opacity:1; transform:translateX(0);} to {opacity:0; transform:translateX(100px);} }

@keyframes shake {
    0%,100%{transform:translateX(0);}
    10%,30%,50%,70%,90%{transform:translateX(-5px);}
    20%,40%,60%,80%{transform:translateX(5px);}
}

/* --- Dark / Light Theme Toggle --- */
.theme-toggle-btn {
    background: #ffc107;
    color: #333;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    background: #e0a800;
    transform: translateY(-1px);
}

body.light-mode {
    background: linear-gradient(135deg, #f5f7fa 0%, #e0e5ec 100%);
    color: #333;
}

body.light-mode .dashboard-header {
    background: #f8f9fa;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

body.light-mode .course-card {
    background: white;
    border: 1px solid #d1d5db;
}

body.light-mode .btn-primary {
    background: #667eea;
    color: white;
}

body.light-mode .btn-secondary {
    background: #fff;
    color: #667eea;
    border: 2px solid #667eea;
}

body.light-mode .dashboard-footer {
    background: #f1f3f5;
    color: #333;
}

/* --- Logout Modal --- */
.logout-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.logout-modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.logout-modal-header {
    background: linear-gradient(135deg, #ff4757, #ff3742);
    color: white;
    padding: 20px;
    text-align: center;
}

.logout-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.logout-modal-body {
    padding: 30px 20px;
    text-align: center;
    color: #333;
}

.logout-modal-body p {
    font-size: 1rem;
    margin: 0;
    color: #555;
}

.logout-modal-footer {
    padding: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    background: rgba(248, 249, 250, 0.8);
}

.btn-danger {
    padding: 12px 24px;
    background: linear-gradient(135deg, #ff4757, #ff3742);
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff3742, #ff4757);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.6);
}

/* --- Improved Course Cards --- */
.courses-section {
    margin-bottom: 40px;
}

.courses-section h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #fff;
    text-align: center;
}

.section-description {
    text-align: center;
    color: #ddd;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.course-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.course-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

.course-icon {
    text-align: center;
    margin-bottom: 20px;
}

.course-icon i {
    font-size: 3rem;
    color: #00c6ff;
    margin-bottom: 15px;
}

.course-info h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: #00c6ff;
    font-weight: 600;
}

.course-info h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #fff;
    font-weight: 500;
}

.course-info p {
    color: #ddd;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.course-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-primary, .btn-secondary {
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    flex: 1;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* --- Light Mode Improvements --- */
body.light-mode .dashboard-header {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode .logo h1 {
    color: #333;
}

body.light-mode .user-info {
    color: #333;
}

body.light-mode .theme-toggle-btn {
    background: rgba(255, 193, 7, 0.2);
    border-color: #ffc107;
}

body.light-mode .courses-section h2 {
    color: #333;
}

body.light-mode .section-description {
    color: #666;
}

body.light-mode .course-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

body.light-mode .course-card:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

body.light-mode .course-info h4 {
    color: #333;
}

body.light-mode .course-info p {
    color: #666;
}

body.light-mode .btn-secondary {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border-color: #667eea;
}

body.light-mode .btn-secondary:hover {
    background: rgba(102, 126, 234, 0.2);
}

body.light-mode .dashboard-footer {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .dashboard-container {
        margin: 10px;
        padding: 0 10px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .courses-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .course-actions {
        flex-direction: column;
    }
    
    .logout-modal-content {
        margin: 20px;
    }
    
    .logout-modal-footer {
        flex-direction: column;
    }
}
