/*
 * ملف CSS الرئيسي
 * المركز الجامعي عبد الحفيظ بوف
 * تصميم متجاوب مع دعم اللغة العربية
 */

/* الخطوط والإعدادات الأساسية */
:root {
    --primary-color: #2c5aa0;
    --secondary-color: #f8b500;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --white-color: #ffffff;
    
    --gradient-primary: linear-gradient(135deg, #2c5aa0 0%, #1e3d72 100%);
    --gradient-secondary: linear-gradient(135deg, #f8b500 0%, #e09900 100%);
    --gradient-light: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.2);
    --shadow-xl: 0 12px 24px rgba(0,0,0,0.25);
    
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    
    --transition: all 0.3s ease;
    --transition-fast: all 0.2s ease;
    --transition-slow: all 0.5s ease;
}

* {
    box-sizing: border-box;
}

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

/* تحسينات الطباعة */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    font-weight: 700;
}

p {
    margin-bottom: 1rem;
}

.lead {
    font-size: 1.125rem;
    font-weight: 400;
}

/* شريط التنقل */
.navbar {
    background: var(--gradient-primary) !important;
    box-shadow: var(--shadow-md);
    padding: 1rem 0;
    transition: var(--transition);
}

.navbar.scrolled {
    padding: 0.5rem 0;
    background: rgba(44, 90, 160, 0.95) !important;
    backdrop-filter: blur(10px);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    transition: var(--transition);
}

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

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 50%;
    width: 0;
    height: 2px;
    background-color: var(--secondary-color);
    transition: var(--transition);
    transform: translateX(50%);
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
    width: 80%;
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius-lg);
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    text-align: right;
}

.dropdown-toggle::after {
    margin-right: 0.5rem;
    margin-left: 0;
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: var(--transition);
    text-align: right;
}

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

/* المحتوى الرئيسي */
.main-content {
    margin-top: 76px; /* ارتفاع شريط التنقل */
}

/* قسم الشرائح */
.hero-slider {
    position: relative;
    height: 70vh;
    min-height: 500px;
    overflow: hidden;
}

.carousel-item {
    height: 70vh;
    min-height: 500px;
    position: relative;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7);
}

.carousel-caption {
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    padding: 2rem 0;
}

.carousel-caption h1 {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 1.5rem;
}

.carousel-caption p {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    font-size: 1.2rem;
}

.carousel-indicators {
    bottom: 2rem;
}

.carousel-indicators button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 0.5rem;
    background-color: rgba(255, 255, 255, 0.5);
    border: 2px solid white;
    transition: var(--transition);
}

.carousel-indicators button.active {
    background-color: var(--secondary-color);
    transform: scale(1.2);
}

.carousel-control-prev,
.carousel-control-next {
    width: 5%;
    opacity: 0.8;
    transition: var(--transition);
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 1;
}

/* قسم الترحيب */
.welcome-section {
    padding: 5rem 0;
}

.welcome-image img {
    border-radius: var(--border-radius-xl);
    transition: var(--transition);
}

.welcome-image:hover img {
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

/* قسم الإحصائيات */
.statistics-section {
    background: var(--gradient-light);
    position: relative;
    overflow: hidden;
}

.statistics-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: -50%;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.5;
    z-index: 1;
}

.statistics-section .container {
    position: relative;
    z-index: 2;
}

.stat-card {
    background: white;
    padding: 2.5rem 1.5rem;
    border-radius: var(--border-radius-xl);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
}

.stat-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.stat-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1);
    color: var(--secondary-color);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.stat-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-color);
}

/* بطاقات الكليات - تم التعديل */
.faculty-card {
    background: white;
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.faculty-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.faculty-logo {
    padding: 2rem;
    text-align: center;
    background: var(--gradient-light);
    flex: 1;
    min-height: 180px;
    max-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* تأثير خلفية للوغو */
.faculty-logo::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0.05;
    z-index: 1;
}

.faculty-logo img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: var(--transition);
    position: relative;
    z-index: 2;
    padding: 10px;
}

/* تحسينات للشعارات الأفقية */
.faculty-card.horizontal-logo .faculty-logo {
    height: 45%;
    min-height: 150px;
    max-height: 180px;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.faculty-card.horizontal-logo .faculty-logo img {
    max-width: 90%;
    max-height: 100px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* تأثير خاص للشعارات الأفقية عند التحويم */
.faculty-card.horizontal-logo:hover .faculty-logo {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.faculty-card.horizontal-logo:hover .faculty-logo img {
    transform: scale(1.08);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

/* تأثير عند التحويم */
.faculty-card:hover .faculty-logo img {
    transform: scale(1.1);
}

.faculty-card:hover .faculty-logo::before {
    opacity: 0.1;
    background: var(--gradient-secondary);
}

.faculty-content {
    padding: 1.5rem;
    background: white;
    flex-shrink: 0;
}

.faculty-name {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1rem;
}

.faculty-description {
    color: var(--dark-color);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* الشعارات العمودية (الطويلة) */
.faculty-card.vertical-logo .faculty-logo {
    height: 60%;
    min-height: 200px;
    max-height: 250px;
}

.faculty-card.vertical-logo .faculty-logo img {
    max-width: 70%;
    max-height: 85%;
}

/* الشعارات المربعة */
.faculty-card.square-logo .faculty-logo {
    height: 50%;
    min-height: 170px;
    max-height: 200px;
}

.faculty-card.square-logo .faculty-logo img {
    max-width: 80%;
    max-height: 80%;
    border-radius: 8px;
}

/* تأثيرات تحميل للصور */
.faculty-logo {
    position: relative;
    overflow: hidden;
}

.faculty-logo::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        rgba(255,255,255,0) 0%, 
        rgba(255,255,255,0.3) 50%, 
        rgba(255,255,255,0) 100%);
    transform: translateX(-100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.faculty-card.loaded .faculty-logo::after {
    display: none;
}

/* بطاقات الإنجازات */
.achievement-card {
    background: white;
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

.achievement-image {
    height: 200px;
    overflow: hidden;
    position: relative;
}

.achievement-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.achievement-card:hover .achievement-image img {
    transform: scale(1.1);
}

.achievement-content {
    padding: 1.5rem;
    flex-grow: 1;
}

.achievement-date {
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.achievement-title {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1rem;
}

.achievement-description {
    color: var(--dark-color);
    line-height: 1.6;
}

/* بطاقات المؤتمرات */
.conference-card {
    background: white;
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    height: 100%;
    position: relative;
}

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

.conference-image {
    height: 180px;
    overflow: hidden;
    position: relative;
}

.conference-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.conference-card:hover .conference-image img {
    transform: scale(1.05);
}

.conference-content {
    padding: 1.5rem;
}

.conference-date {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.conference-title {
    color: var(--dark-color);
    font-weight: 600;
    margin-bottom: 1rem;
}

.conference-description {
    color: var(--dark-color);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.conference-location {
    color: var(--secondary-color);
    font-weight: 500;
    font-size: 0.9rem;
}

/* الأزرار */
.btn {
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    border: none;
    position: relative;
    overflow: hidden;
}

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

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

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, #1e3d72 0%, #2c5aa0 100%);
}

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

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* التذييل */
.footer {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient-secondary);
}

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

.footer-title {
    color: white;
    font-weight: 600;
    margin-bottom: 1.5rem;
    position: relative;
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    right: 0;
    width: 50px;
    height: 2px;
    background: var(--secondary-color);
}

.footer-description {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
    padding-right: 1rem;
}

.footer-links a::before {
    content: '◀';
    position: absolute;
    right: 0;
    color: var(--secondary-color);
    opacity: 0;
    transform: translateX(10px);
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
    padding-right: 1.5rem;
}

.footer-links a:hover::before {
    opacity: 1;
    transform: translateX(0);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: var(--transition);
}

.social-link:hover {
    background: var(--secondary-color);
    color: var(--dark-color);
    transform: translateY(-3px);
}

.contact-info {
    margin-top: 1rem;
}

.contact-item {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.contact-item i {
    color: var(--secondary-color);
    margin-left: 0.5rem;
    width: 20px;
}

.footer-divider {
    border-color: rgba(255, 255, 255, 0.2);
    margin: 2rem 0;
}

.footer-copyright,
.footer-credits {
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

/* زر العودة للأعلى */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
    background: var(--gradient-secondary);
}

/* تحسينات الاستجابة */
@media (max-width: 768px) {
    .hero-slider {
        height: 50vh;
        min-height: 400px;
    }
    
    .carousel-item {
        height: 50vh;
        min-height: 400px;
    }
    
    .carousel-caption h1 {
        font-size: 2rem;
    }
    
    .carousel-caption p {
        font-size: 1rem;
    }
    
    .welcome-section {
        padding: 3rem 0;
    }
    
    .stat-card {
        margin-bottom: 2rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .back-to-top {
        bottom: 1rem;
        left: 1rem;
        width: 45px;
        height: 45px;
    }
    
    .navbar-nav .nav-link {
        margin: 0.25rem 0;
    }
    
    .navbar-collapse {
        background: var(--gradient-primary);
        padding: 1rem;
        border-radius: var(--border-radius);
        margin-top: 1rem;
        box-shadow: var(--shadow-lg);
    }
    
    .dropdown-menu {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .dropdown-item {
        color: rgba(255, 255, 255, 0.9);
    }
    
    .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.2);
        color: white;
    }
    
    /* تحسينات بطاقات الكليات للشاشات الصغيرة */
    .faculty-logo {
        min-height: 160px;
        max-height: 200px;
        padding: 1.5rem;
    }
    
    .faculty-card.horizontal-logo .faculty-logo {
        min-height: 130px;
        max-height: 160px;
    }
    
    .faculty-card.horizontal-logo .faculty-logo img {
        max-height: 80px;
    }
    
    .faculty-card.vertical-logo .faculty-logo {
        min-height: 180px;
    }
}

@media (max-width: 576px) {
    .hero-slider {
        height: 40vh;
        min-height: 300px;
    }
    
    .carousel-item {
        height: 40vh;
        min-height: 300px;
    }
    
    .carousel-caption {
        padding: 1rem 0;
    }
    
    .carousel-caption h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .carousel-caption p {
        font-size: 0.9rem;
    }
    
    .stat-card {
        padding: 2rem 1rem;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .stat-icon {
        font-size: 2.5rem;
    }
    
    /* تحسينات إضافية للبطاقات */
    .faculty-logo {
        min-height: 140px;
        max-height: 180px;
        padding: 1rem;
    }
    
    .faculty-logo img {
        max-height: 80px;
    }
    
    .faculty-card.horizontal-logo .faculty-logo {
        min-height: 120px;
        max-height: 140px;
        padding: 1rem;
    }
    
    .faculty-card.horizontal-logo .faculty-logo img {
        max-height: 70px;
    }
}

/* تحسينات إضافية للعربية */
.text-end {
    text-align: left !important;
}

.text-start {
    text-align: right !important;
}

.me-2 {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

.ms-2 {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
}

/* تأثيرات الحركة */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* تحسين الأداء */
.img-fluid {
    transition: var(--transition);
}

.card, .faculty-card, .achievement-card, .conference-card {
    will-change: transform;
}

/* تحسين إمكانية الوصول */
.btn:focus,
.nav-link:focus,
.dropdown-item:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* تحسين الطباعة */
@media print {
    .navbar,
    .footer,
    .back-to-top,
    .carousel-control-prev,
    .carousel-control-next,
    .carousel-indicators {
        display: none !important;
    }
    
    .main-content {
        margin-top: 0;
    }
    
    .hero-slider {
        height: auto;
        min-height: auto;
    }
    
    .carousel-item {
        height: auto;
        min-height: auto;
    }
    
    .carousel-item img {
        max-height: 300px;
    }
}

.language-switcher .dropdown-toggle {
    color: #fff !important;
    padding: 0.5rem 0.75rem;
}

.language-switcher .dropdown-toggle:hover {
    background-color: rgba(255,255,255,0.1);
    border-radius: 0.375rem;
}

.language-switcher img {
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
}