/* Main Styles for Digital Future Website */

/* Import Google Fonts - Tajawal for Arabic and Poppins for English */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Tajawal:wght@300;400;500;700&display=swap');

/* Base Styles */
:root {
    --primary: #3b82f6; /* blue-500 */
    --primary-dark: #2563eb; /* blue-600 */
    --secondary: #8b5cf6; /* purple-500 */
    --secondary-dark: #7c3aed; /* purple-600 */
    --accent: #06b6d4; /* cyan-500 */
    --accent-dark: #0891b2; /* cyan-600 */
    --text-primary: #1f2937; /* gray-800 */
    --text-secondary: #4b5563; /* gray-600 */
    --text-light: #9ca3af; /* gray-400 */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb; /* gray-50 */
    --bg-tertiary: #f3f4f6; /* gray-100 */
    --border-color: #e5e7eb; /* gray-200 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition-default: all 0.3s ease;
}

/* Dark Mode Variables - Enhanced */
.dark {
    /* Enhanced Text Colors */
    --text-primary: #ffffff; /* pure white for maximum readability */
    --text-secondary: #f1f5f9; /* slate-100 */
    --text-light: #94a3b8; /* slate-400 */
    
    /* Enhanced Background Colors */
    --bg-primary: #0f172a; /* slate-900 - deeper background */
    --bg-secondary: #1e293b; /* slate-800 */
    --bg-tertiary: #334155; /* slate-700 */
    
    /* Enhanced Border Colors */
    --border-color: #475569; /* slate-600 */
    
    /* Enhanced Primary Colors */
    --primary: #4f46e5; /* indigo-600 - professional primary */
    --primary-dark: #3730a3; /* indigo-700 */
    --secondary: #7c3aed; /* violet-600 */
    --secondary-dark: #5b21b6; /* violet-700 */
    --accent: #0891b2; /* cyan-600 */
    --accent-dark: #0e7490; /* cyan-700 */
    
    /* Enhanced Shadows */
    --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 12px -2px rgba(0, 0, 0, 0.5), 0 4px 8px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 24px -4px rgba(0, 0, 0, 0.6), 0 8px 16px -4px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 24px 32px -8px rgba(0, 0, 0, 0.7), 0 16px 24px -8px rgba(0, 0, 0, 0.5);
}

/* Typography */
html[lang="ar"] body {
    font-family: 'Tajawal', sans-serif;
}

html[lang="en"] body {
    font-family: 'Poppins', sans-serif;
}

/* Common Elements */
html, body {
    min-height: 100vh;
    max-width: 100%;
    overflow-x: hidden;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: var(--transition-default);
}

/* Ensure all embedded content is responsive */
iframe, embed, object, video {
    max-width: 100%;
    height: auto;
}

/* Fix for tables to prevent horizontal scroll */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Fix for all pages to prevent horizontal scroll */
.container-fluid, .container {
    width: 100%;
    max-width: 100%;
    padding-right: var(--bs-gutter-x, 0.75rem);
    padding-left: var(--bs-gutter-x, 0.75rem);
    margin-right: auto;
    margin-left: auto;
    overflow-x: hidden;
}

/* Enhanced Glassmorphism Effect */
.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}



.glass-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    pointer-events: none;
}

.dark .glass-effect::before {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(124, 58, 237, 0.05) 100%);
}

.dark .glass-effect {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 24px 32px -8px rgba(0, 0, 0, 0.7), 0 16px 24px -8px rgba(0, 0, 0, 0.5);
}

.dark .glass-effect::before {
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
}

/* Background Pattern */
.bg-pattern {
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    background-size: 400px 400px;
    background-position: 0 0, 200px 200px;
    animation: float 20s ease-in-out infinite;
}

.dark .bg-pattern {
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(79, 70, 229, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(124, 58, 237, 0.15) 0%, transparent 50%);
    background-color: var(--bg-primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Animations */
@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
    100% {
        transform: translateY(0px);
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

/* Custom Utilities */
.text-gradient {
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    background-image: linear-gradient(to right, var(--primary), var(--secondary));
}

/* Background Gradient - Clean without overlays */
.bg-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    position: relative;
}

.dark .bg-gradient {
    background: linear-gradient(135deg, #1e293b, #334155);
}

/* Mobile Sidebar Styles */
.mobile-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 9999;
    overflow-y: auto;
}

.mobile-sidebar.active {
    right: 0;
}

.dark .mobile-sidebar {
    background: rgba(17, 24, 39, 0.95);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
}

.mobile-sidebar-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.mobile-sidebar .nav-link {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-weight: 500;
}

.mobile-sidebar .nav-link:hover {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    transform: translateX(8px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.mobile-sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.mobile-sidebar .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.mobile-sidebar .nav-link:hover::before {
    left: 100%;
}

/* Enhanced Button Styles */
.btn {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 2px solid transparent;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary-dark));
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

/* Theme Toggle Button */
.theme-toggle-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-icon .moon,
.theme-toggle-icon .sun {
    position: absolute;
    transition: all 0.3s ease;
}

.theme-toggle-icon .sun {
    opacity: 0;
    transform: rotate(180deg) scale(0.5);
}

.dark .theme-toggle-icon .moon {
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
}

.dark .theme-toggle-icon .sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Language Toggle Button */
#language-toggle,
#mobile-language-toggle {
    min-width: 50px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Navigation Enhancements */
.navbar {
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.navbar-brand img {
    height: 45px;
    width: auto;
    transition: all 0.3s ease;
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

.navbar-nav .nav-link {
    position: relative;
    padding: 8px 16px;
    margin: 0 4px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    transform: translateY(-1px);
}

.navbar-nav .nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Mobile Menu Button */
#mobile-menu-button {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

#mobile-menu-button:hover {
    background: var(--primary);
    color: white;
    transform: rotate(90deg);
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Logo Styles */
.h-10 {
    height: 45px;
}

.light-logo {
    display: block;
}

.dark-logo {
    display: none;
}

.dark .light-logo {
    display: none;
}

.dark .dark-logo {
    display: block;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .mobile-sidebar {
        width: 280px;
    }
    
    .navbar-brand img {
        height: 35px;
    }
}

/* Enhanced Dark Mode Styles */
.dark .glass-effect {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 24px -4px rgba(0, 0, 0, 0.6), 0 8px 16px -4px rgba(0, 0, 0, 0.4);
}

/* Dark Mode Navigation */
.dark .navbar {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dark .nav-link {
    color: var(--text-secondary) !important;
    transition: all 0.3s ease;
}

.dark .nav-link:hover,
.dark .nav-link.active {
    color: var(--primary) !important;
    text-shadow: 0 0 10px rgba(79, 70, 229, 0.5);
}

/* Card Styles */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Improve card responsiveness */
@media (max-width: 767.98px) {
    .card {
        margin-bottom: 20px;
        width: 100%;
    }
    
    .card-img-top {
        max-height: 200px;
        object-fit: cover;
        width: 100%;
    }
    
    /* Improve department cards on mobile */
    #departments-section .card {
        height: auto;
        margin-bottom: 1.5rem;
    }
    
    /* Improve stats section on mobile */
    #stats-section .chart-container {
        height: 220px;
        width: 100%;
    }
    
    /* Improve collaboration section on mobile */
    #collaboration-section img {
        margin-top: 1.5rem;
        max-width: 100%;
    }
    
    /* Fix container padding */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Fix table overflow */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }
}

@media (max-width: 575.98px) {
    .card-body {
        padding: 1rem;
    }
    
    .card-title {
        font-size: 1.25rem;
    }
    
    .card-text {
        font-size: 0.9rem;
    }
    
    /* Improve CTA section on small devices */
    #cta-section {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    /* Fix images on small screens */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Fix navbar on small screens */
    .navbar-brand img {
        height: 30px;
    }
    
    /* Fix container padding */
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Fix font sizes for better readability */
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.3rem;
    }
}

/* Dark Mode Cards */
.dark .card {
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-tertiary));
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.dark .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 30px rgba(79, 70, 229, 0.3);
}

/* Dark Mode Buttons */
.dark .btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.dark .btn-outline-primary:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.4);
}

/* Dark Mode Mobile Sidebar */
.dark .mobile-sidebar {
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
}

.dark .mobile-sidebar-content {
    background: var(--bg-secondary);
}

/* Responsive Styles */
@media (max-width: 1199.98px) {
    .container {
        max-width: 95%;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    /* Prevent horizontal overflow */
    .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Fix grid columns */
    [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Fix grid system */
    .grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 991.98px) {
    h1 {
        font-size: 2.25rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    .hero-section {
        padding: 80px 0;
    }
    
    .section-padding {
        padding: 60px 0;
    }
}

@media (max-width: 767.98px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    .hero-section {
        padding: 60px 0;
    }
    
    .section-padding {
        padding: 40px 0;
    }
    
    .card {
        margin-bottom: 20px;
    }
}

@media (max-width: 575.98px) {
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.35rem;
    }
    
    h3 {
        font-size: 1.15rem;
    }
    
    p {
        font-size: 0.95rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .navbar-brand img {
        max-height: 40px;
    }
}

@media (max-width: 480px) {
    .mobile-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .mobile-sidebar.active {
        right: 0;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Fix for small mobile devices */
    body {
        width: 100%;
        overflow-x: hidden;
    }
    
    /* Adjust padding for small screens */
    .container, .container-fluid {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    /* Fix navbar on very small screens */
    .navbar-brand {
        max-width: 50%;
    }
    
    /* Ensure text doesn't overflow */
    p, h1, h2, h3, h4, h5, h6, span, a {
        word-wrap: break-word;
    }
}