/* Custom Styles for Mashariq Al-Imar */

/* Fonts */
body[dir="rtl"] {
    font-family: 'Cairo', sans-serif;
}

body[dir="ltr"] {
    font-family: 'Roboto', sans-serif;
}

/* General Styles */
body {
    line-height: 1.7;
}

/* Navigation */
.navbar {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-size: 1.5rem;
}

.nav-link {
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover {
    color: #ffc107 !important;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
}

/* Cards */
.hover-card {
    transition: transform 0.3s, box-shadow 0.3s;
}

.hover-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* Statistics */
.stat-card {
    padding: 20px;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: scale(1.05);
}

.counter {
    font-size: 3rem;
    color: #0d6efd;
}

/* Buttons */
.btn {
    border-radius: 50px;
    padding: 12px 30px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0a58ca 0%, #084298 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(13, 110, 253, 0.3);
}

/* Footer */
footer {
    background: linear-gradient(135deg, #212529 0%, #343a40 100%);
}

footer a:hover {
    color: #ffffff !important;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .display-4 {
        font-size: 1.75rem;
    }

    .display-5 {
        font-size: 1.5rem;
    }

    .lead {
        font-size: 1rem;
    }

    .counter {
        font-size: 2rem;
    }

    .hero-section {
        min-height: 50vh !important;
        padding: 2rem 0 !important;
    }

    .hero-section h1 {
        font-size: 1.5rem !important;
    }

    .hero-section p {
        font-size: 0.9rem;
    }

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

    .navbar-brand {
        font-size: 1.2rem;
    }

    .card {
        margin-bottom: 1rem;
    }

    .stat-card {
        padding: 10px;
        margin-bottom: 1rem;
    }

    .stat-card i {
        font-size: 2rem !important;
    }

    .stat-card h2 {
        font-size: 1.5rem !important;
    }

    .stat-card p {
        font-size: 0.85rem;
    }

    /* Better spacing on mobile */
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .mb-4 {
        margin-bottom: 1.5rem !important;
    }

    /* Footer adjustments */
    footer {
        font-size: 0.9rem;
    }

    footer h5 {
        font-size: 1.1rem;
    }

    /* Form inputs */
    .form-control, .form-select {
        font-size: 1rem;
    }

    /* Navigation */
    .navbar-nav {
        padding: 1rem 0;
    }

    .nav-link {
        padding: 0.5rem 1rem;
    }

    /* Cards */
    .card-body {
        padding: 1rem;
    }

    .card-title {
        font-size: 1.1rem;
    }

    /* Hide large icons on very small screens */
    .fa-10x {
        font-size: 5rem !important;
    }
}

/* Extra small devices */
@media (max-width: 576px) {
    .display-4 {
        font-size: 1.5rem;
    }

    .hero-section h1 {
        font-size: 1.3rem !important;
    }

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

    .stat-card {
        padding: 0.5rem;
    }

    .counter {
        font-size: 1.5rem;
    }

    .fa-10x {
        display: none;
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Tablet specific */
@media (min-width: 768px) and (max-width: 991px) {
    .display-4 {
        font-size: 2.5rem;
    }

    .hero-section {
        min-height: 60vh !important;
    }

    .counter {
        font-size: 2.5rem;
    }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #0d6efd;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0a58ca;
}

/* Dropdown for language switcher */
.dropdown-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: start;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item form {
    display: inline;
    width: 100%;
}

.dropdown-menu {
    padding: 0;
}

.dropdown-menu li form {
    margin: 0;
}

/* Mobile menu improvements */
@media (max-width: 991px) {
    .navbar-collapse {
        background: #0d6efd;
        padding: 1rem;
        margin-top: 1rem;
        border-radius: 0.5rem;
    }

    .dropdown-menu {
        background: rgba(255,255,255,0.1);
        border: none;
    }

    .dropdown-item {
        color: white;
    }

    .dropdown-item:hover {
        background-color: rgba(255,255,255,0.2);
    }
}

/* RTL Specific */
[dir="rtl"] .me-2 {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

[dir="rtl"] .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

/* Form Styles */
.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Badge */
.badge {
    padding: 0.5em 1em;
    font-weight: 500;
}

/* Card Image Overlay */
.card-img-overlay {
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.7) 100%);
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Button loading state */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #0d6efd;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: none;
}

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

.back-to-top:hover {
    background: #0a58ca;
    transform: translateY(-5px);
}

[dir="rtl"] .back-to-top {
    right: auto;
    left: 30px;
}

/* Active nav link highlighting */
.nav-link.active {
    color: #ffc107 !important;
    font-weight: 600;
}

/* Image lazy loading optimization */
img[loading="lazy"] {
    transition: opacity 0.3s;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* WhatsApp floating button */
.whatsapp-float {
    position: fixed;
    bottom: 90px;
    right: 30px;
    background: #25d366;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s;
    text-decoration: none;
}

.whatsapp-float:hover {
    background: #20ba5a;
    transform: scale(1.1);
    color: white;
}

[dir="rtl"] .whatsapp-float {
    right: auto;
    left: 30px;
}

/* Focus states for better accessibility */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
    outline: 3px solid #0d6efd;
    outline-offset: 2px;
}

/* Enhanced mobile touch targets */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ========== Carousel Improvements ========== */
/* Carousel container */
.carousel-item {
    position: relative;
    overflow: hidden;
}

/* Carousel images - better fitting */
.carousel-item img {
    width: 100%;
    height: 70vh;
    object-fit: cover;
    object-position: center;
}

/* Carousel caption improvements */
.carousel-caption {
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.5) 60%, rgba(0,0,0,0.2) 100%);
    left: 0 !important;
    right: 0 !important;
    bottom: 0;
    padding: 3rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

/* Carousel text styling */
.carousel-caption h2 {
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
    margin-bottom: 1rem;
}

.carousel-caption p {
    text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
}

/* Carousel controls */
.carousel-control-prev,
.carousel-control-next {
    width: 5%;
    opacity: 0.7;
}

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

/* Carousel indicators */
.carousel-indicators button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 5px;
}

/* Responsive carousel */
@media (max-width: 768px) {
    .carousel-item img {
        height: 50vh;
    }

    .carousel-caption {
        padding: 2rem 0.5rem 1rem;
    }

    .carousel-caption h2 {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem;
    }

    .carousel-caption p {
        font-size: 0.9rem !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .carousel-caption .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    .carousel-control-prev,
    .carousel-control-next {
        width: 10%;
    }
}

@media (max-width: 576px) {
    .carousel-item img {
        height: 40vh;
    }

    .carousel-caption h2 {
        font-size: 1.2rem !important;
    }

    .carousel-caption p {
        font-size: 0.8rem !important;
        -webkit-line-clamp: 1;
    }

    .carousel-caption .btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }

    .carousel-indicators {
        margin-bottom: 0.5rem;
    }

    .carousel-indicators button {
        width: 8px;
        height: 8px;
    }
}

/* Large screens */
@media (min-width: 1200px) {
    .carousel-item img {
        height: 75vh;
    }
}