/**
 * S4U Learning Platform - Main Stylesheet
 * Branding: #181f4e, #954c2e, #f0eceb
 * Font: DIN Next LT Arabic
 */

/* Import DIN Next LT Arabic Font */
@font-face {
    font-family: 'DIN Next LT Arabic';
    src: url('../fonts/DINNextLTArabic-Regular.woff2') format('woff2'),
         url('../fonts/DINNextLTArabic-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
}

/* Bold font will use Regular with synthetic bold */
/* @font-face {
    font-family: 'DIN Next LT Arabic';
    src: url('../fonts/DINNextLTArabic-Bold.woff2') format('woff2'),
         url('../fonts/DINNextLTArabic-Bold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
} */

/* CSS Variables for Light Mode */
:root {
    --primary-color: #181f4e;
    --secondary-color: #954c2e;
    --light-color: #f0eceb;
    --bg-color: #ffffff;
    --text-color: #333333;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --sidebar-bg: #181f4e;
    --sidebar-text: #ffffff;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
}

/* CSS Variables for Dark Mode */
[data-theme="dark"] {
    --primary-color: #181f4e;
    --secondary-color: #954c2e;
    --light-color: #f0eceb;
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: #333333;
    --sidebar-bg: #0f1225;
    --sidebar-text: #ffffff;
    --card-bg: #252525;
    --input-bg: #2a2a2a;
    --shadow: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.3);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DIN Next LT Arabic', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* RTL Support */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--secondary-color);
    font-weight: 700;
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #0f1225;
    border-color: #0f1225;
}

.btn-secondary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #7a3f25;
    border-color: #7a3f25;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    background-color: var(--primary-color);
    color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    font-weight: 700;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    height: 100vh;
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 0;
    z-index: 1000;
    transition: transform 0.3s ease, left 0.3s ease, right 0.3s ease;
    overflow-y: auto;
}

[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
}

[dir="ltr"] .sidebar {
    left: 0;
    right: auto;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-header img {
    max-width: 150px;
    height: auto;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-menu a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: rgba(255,255,255,0.1);
    color: var(--light-color);
}

.sidebar-menu .menu-icon {
    margin-inline-end: 0.75rem;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    padding: 2rem;
    padding-top: 5rem; /* Space for navbar */
    min-height: 100vh;
    transition: margin 0.3s ease, margin-left 0.3s ease, margin-right 0.3s ease;
}

[dir="rtl"] .main-content {
    margin-right: 260px;
    margin-left: 0;
}

[dir="ltr"] .main-content {
    margin-left: 260px;
    margin-right: 0;
}

.sidebar-collapsed .main-content {
    margin-left: 0;
    margin-right: 0;
}

[dir="rtl"].sidebar-collapsed .main-content {
    margin-right: 0;
    margin-left: 0;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.8rem 2rem;
    box-shadow: var(--shadow);
    z-index: 999;
    transition: left 0.3s ease, right 0.3s ease;
    min-height: 60px;
}

[dir="rtl"] .navbar {
    left: 260px;
    right: 0;
}

[dir="ltr"] .navbar {
    left: 260px;
    right: 0;
}

/* Navbar brand removed - logo no longer in navbar */

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.theme-toggle:hover {
    color: var(--secondary-color);
}

/* Language Toggle */
.lang-toggle {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
    background: var(--light-color);
    border-radius: 8px;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.lang-toggle .lang-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-muted);
    position: relative;
    overflow: hidden;
}

.lang-toggle .lang-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.lang-toggle .lang-btn i,
.lang-toggle .lang-btn .lang-text {
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.lang-toggle .lang-btn:hover {
    color: var(--primary-color);
    transform: translateY(-1px);
}

.lang-toggle .lang-btn:hover::before {
    opacity: 0.1;
}

.lang-toggle .lang-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(24, 31, 78, 0.3);
    transform: translateY(0);
}

.lang-toggle .lang-btn.active::before {
    opacity: 0;
}

.lang-toggle .lang-btn.active:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(24, 31, 78, 0.4);
}

.lang-toggle .lang-btn.active i {
    color: #ffffff;
    transform: scale(1.1);
}

.lang-toggle .lang-btn.active .lang-text {
    color: #ffffff;
    font-weight: 600;
}

/* RTL Support for Language Toggle */
[dir="rtl"] .lang-toggle {
    flex-direction: row-reverse;
}

/* Responsive Language Toggle */
@media (max-width: 768px) {
    .lang-toggle .lang-btn .lang-text {
        display: none;
    }
    
    .lang-toggle .lang-btn {
        padding: 0.5rem;
        min-width: 40px;
        justify-content: center;
    }
    
    .lang-toggle {
        gap: 0.15rem;
        padding: 0.2rem;
    }
}

/* Notifications */
.notification-badge {
    position: relative;
}

.notification-badge .badge {
    position: absolute;
    top: -5px;
    inset-inline-end: -5px;
    background-color: var(--secondary-color);
    color: #ffffff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    inset-inline-end: 0;
    width: 350px;
    max-height: 400px;
    overflow-y: auto;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
}

.notification-dropdown.show {
    display: block;
}

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.notification-item:hover {
    background-color: var(--light-color);
}

.notification-item.unread {
    background-color: rgba(25, 31, 78, 0.1);
}

/* Forms */
.form-control,
.form-select {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.75rem;
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(25, 31, 78, 0.25);
}

.form-label {
    color: var(--text-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Tables */
.table {
    background-color: var(--card-bg);
    color: var(--text-color);
}

.table thead {
    background-color: var(--primary-color);
    color: #ffffff;
}

.table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: var(--light-color);
}

/* Badges */
.badge {
    padding: 0.35em 0.65em;
    border-radius: 4px;
    font-weight: 600;
}

.badge-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

.badge-secondary {
    background-color: var(--secondary-color);
    color: #ffffff;
}

.badge-success {
    background-color: #28a745;
    color: #ffffff;
}

.badge-danger {
    background-color: #dc3545;
    color: #ffffff;
}

.badge-warning {
    background-color: #ffc107;
    color: #000000;
}

/* Progress Bars */
.progress {
    background-color: var(--light-color);
    border-radius: 4px;
    height: 1.5rem;
}

.progress-bar {
    background-color: var(--primary-color);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Alerts */
.alert {
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.alert-primary {
    background-color: rgba(25, 31, 78, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.alert-secondary {
    background-color: rgba(149, 76, 46, 0.1);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--light-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .navbar {
        left: 0 !important;
        right: 0 !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 1rem;
        padding-top: 5rem;
    }
    
    [dir="rtl"] .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
    
    [dir="ltr"] .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .notification-dropdown {
        width: 100%;
        inset-inline-end: 0;
        inset-inline-start: 0;
    }
}

/* Utility Classes */
.text-primary {
    color: var(--primary-color) !important;
}

.text-secondary {
    color: var(--secondary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
}

.bg-light {
    background-color: var(--light-color) !important;
}

/* Messages Styles */
.messages-thread {
    padding: 1rem;
}

.message-item {
    word-wrap: break-word;
    transition: transform 0.2s ease;
}

.message-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Notification Styles */
.notification-item {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.notification-item:hover {
    background-color: var(--light-color) !important;
}

.notification-item.unread {
    border-left: 4px solid var(--primary-color);
}

[dir="rtl"] .notification-item.unread {
    border-left: none;
    border-right: 4px solid var(--primary-color);
}

/* Upload Progress Modal */
.upload-progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.upload-progress-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.upload-progress-modal {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.upload-progress-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.upload-progress-header {
    text-align: center;
    margin-bottom: 2rem;
}

.upload-progress-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
    box-shadow: 0 8px 24px rgba(24, 31, 78, 0.3);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 24px rgba(24, 31, 78, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 12px 32px rgba(24, 31, 78, 0.4);
    }
}

.upload-progress-icon i {
    font-size: 2.5rem;
    color: #ffffff;
    animation: spin 2s linear infinite;
}

.upload-progress-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.upload-progress-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.upload-progress-content {
    margin-top: 2rem;
}

.upload-file-item {
    background: var(--light-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.upload-file-item.uploading {
    background: linear-gradient(135deg, rgba(24, 31, 78, 0.1), rgba(149, 76, 46, 0.1));
    border: 2px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(24, 31, 78, 0.15);
}

.upload-file-item.completed {
    background: rgba(40, 167, 69, 0.1);
    border: 2px solid #28a745;
}

.upload-file-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.upload-file-name {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.upload-file-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
}

.upload-file-icon.pdf {
    background: #dc3545;
}

.upload-file-icon.video {
    background: var(--secondary-color);
}

.upload-file-info {
    flex: 1;
    min-width: 0;
}

.upload-file-name-text {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.upload-file-percentage {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 50px;
    text-align: end;
}

.upload-file-item.completed .upload-file-percentage {
    color: #28a745;
}

.upload-progress-bar-container {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    position: relative;
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.upload-progress-bar.completed {
    background: #28a745;
}

.upload-progress-status {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.upload-progress-status-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.upload-progress-status-text.uploading {
    color: var(--primary-color);
}

.upload-progress-status-text.completed {
    color: #28a745;
}

/* Responsive */
@media (max-width: 768px) {
    .upload-progress-modal {
        padding: 1.5rem;
        max-width: 95%;
    }
    
    .upload-progress-icon {
        width: 60px;
        height: 60px;
    }
    
    .upload-progress-icon i {
        font-size: 2rem;
    }
    
    .upload-progress-title {
        font-size: 1.25rem;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .theme-toggle,
    .lang-toggle {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
}

