/* Global Styles and CSS Variables */

:root {
    /* Colors provided by the user, derived from logo.jpeg */
    --color-primary: #7A98C0; /* Darker Blue/Grey */
    --color-secondary: #8BABCA; /* Medium Blue/Grey */
    --color-accent: #A0B1CB; /* Lighter Blue/Grey (Used for highlights/buttons) */
    --color-light: #F2F4F8; /* Very Light Grey (Backgrounds) */
    --color-medium: #8CA8C7; /* Intermediate Blue */
    
    --color-dark: #1C3A5E; /* Deep Navy (Text/Headings) */
    --color-text: #333333;
    --color-white: #ffffff;
    
    --font-primary: 'Tajawal', sans-serif;
    --font-secondary: 'Almarai', sans-serif;
    
    --transition-speed: 0.3s;
    --max-width: 1200px;
    --padding-section: 80px 0;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-white);
    direction: rtl; /* Ensure Right-to-Left context for Arabic */
    text-align: right;
}

.container {
    width: 90%;
    max-width: var(--max-width);
    margin: 0 auto;
}

a {
    text-decoration: none;
    color: var(--color-primary);
    transition: color var(--transition-speed);
}

a:hover {
    color: var(--color-dark);
}

ul {
    list-style: none;
}

/* Typography */
h1, h2, h3, h4 {
    font-family: var(--font-secondary);
    color: var(--color-dark);
    margin-bottom: 0.5em;
    line-height: 1.2;
}

h1 { font-size: 2.8rem; }
h2 { font-size: 2.2rem; }
h3 { font-size: 1.8rem; }
h4 { font-size: 1.4rem; }

p {
    margin-bottom: 1em;
}

.section-padding {
    padding: var(--padding-section);
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    font-size: 2.5rem;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background-color: var(--color-primary);
    margin: 10px auto 0;
}

.bg-light {
    background-color: var(--color-light);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: background-color var(--transition-speed), transform var(--transition-speed);
    border: 2px solid transparent;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background-color: var(--color-dark);
    border-color: var(--color-dark);
    color: var(--color-white);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--color-white);
    color: var(--color-primary);
    border-color: var(--color-secondary);
}

.btn-secondary:hover {
    background-color: var(--color-secondary);
    color: var(--color-dark);
    border-color: var(--color-secondary);
}


/* 1. Header */
.header {
    background-color: var(--color-white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 10px 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 50px; /* Adjust as needed */
    width: auto;
}

.nav-list {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: var(--color-dark);
    font-weight: 500;
    padding: 5px 0;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-primary);
    transition: width var(--transition-speed);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.nav-toggle .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: var(--color-dark);
    transition: var(--transition-speed);
}


/* 2. Hero Section */
.hero {
    background-color: var(--color-medium);
    color: var(--color-white);
    padding: 100px 0;
    text-align: right;
    overflow: hidden;
}

.hero .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.hero-content {
    flex: 1;
}

.hero h1 {
    color: var(--color-white);
    font-size: 3.5rem;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 30px;
    color: var(--color-light);
}

.hero .btn-primary {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
}

.hero .btn-primary:hover {
    background-color: var(--color-dark);
    border-color: var(--color-dark);
}

.hero-image {
    flex: 1;
    text-align: center;
}

.hero-image img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* 3. About Us Section */
.about-content {
    display: flex;
    gap: 40px;
    align-items: center;
}

.about-text {
    flex: 2;
}

.about-director {
    flex: 1;
    text-align: center;
    padding: 20px;
    background-color: var(--color-light);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.about-director img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 15px;
    border: 5px solid var(--color-primary);
}

/* 4. Services Section */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.service-card {
    background-color: var(--color-white);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.service-card i {
    font-size: 3rem;
    color: var(--color-primary);
    margin-bottom: 15px;
}

.service-card h3 {
    margin-bottom: 10px;
}

/* 5. Courses Section */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.course-card {
    background-color: var(--color-white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform var(--transition-speed);
}

.course-card:hover {
    transform: translateY(-5px);
}

.course-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-body {
    padding: 20px;
}

.card-meta {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 15px 0;
    font-size: 0.9rem;
    color: #666;
}

.card-meta i {
    color: var(--color-primary);
    margin-left: 5px;
}


/* 6. Gallery Section (Masonry/Grid + Hover + Lightbox Structure) */
.gallery-grid {
    display: grid;
    grid-gap: 15px;
    /* Responsive Grid for Gallery (Masonry style look achieved via row-gap) */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    grid-auto-rows: minmax(150px, auto); 
    grid-auto-flow: dense;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.gallery-item:nth-child(2n) {
    /* Example for varied sizes to simulate masonry */
    grid-row: span 2; 
}

.gallery-item:nth-child(5n) {
    grid-column: span 2;
}


/* Hover Effect */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(var(--color-primary), 0.8);
    background: rgba(122, 152, 192, 0.8); /* Using actual RGB values for transparency */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.gallery-item:hover .overlay {
    opacity: 1;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.overlay i {
    color: var(--color-white);
    font-size: 2rem;
}

/* Lightbox Styling */
.lightbox {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 2000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.lightbox-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    max-height: 90vh;
    object-fit: contain;
}

.close-btn {
    position: absolute;
    top: 20px;
    left: 35px; /* Position on the left for RTL layout */
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--color-primary);
    text-decoration: none;
    cursor: pointer;
}


/* 7. Contact Section */
.contact-grid {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.contact-details {
    flex: 1;
    min-width: 300px;
}

.contact-form-container {
    flex: 2;
    min-width: 400px;
    background-color: var(--color-light);
    padding: 30px;
    border-radius: 10px;
}

.detail-item {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.detail-item i {
    color: var(--color-primary);
    margin-left: 10px;
}

.map-container {
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
    height: 300px;
    border: 2px solid var(--color-secondary);
}

.map-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: var(--font-primary);
    transition: border-color var(--transition-speed);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.contact-form button {
    width: 100%;
}


/* 8. Footer */
.footer {
    background-color: var(--color-dark);
    color: var(--color-light);
    padding: 40px 0 10px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
}

.footer-logo, .footer-links, .footer-contact {
    min-width: 200px;
    margin-bottom: 20px;
}

.footer-logo img {
    height: 40px;
    filter: brightness(0) invert(1); /* Optional: Make logo white for dark background */
    margin-bottom: 10px;
}

.footer-logo p {
    font-size: 0.9rem;
    color: var(--color-secondary);
}

.footer-links h4, .footer-contact h4 {
    color: var(--color-white);
    margin-bottom: 15px;
}

.footer-links ul li {
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--color-secondary);
}

.footer-links a:hover {
    color: var(--color-primary);
}

.footer-contact p {
    margin-bottom: 8px;
    color: var(--color-secondary);
}

.footer-contact i {
    color: var(--color-primary);
    margin-left: 10px;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.social-links a {
    color: var(--color-light);
    font-size: 1.2rem;
    margin-right: 15px;
}

.social-links a:hover {
    color: var(--color-primary);
}


/* 9. Responsiveness */
@media (max-width: 992px) {
    /* Hero Section adjustments */
    .hero h1 {
        font-size: 2.5rem;
    }
    .hero .container {
        flex-direction: column;
        text-align: center;
    }
    .hero-content {
        margin-bottom: 30px;
    }

    /* About Section adjustments */
    .about-content {
        flex-direction: column;
        text-align: center;
    }
    .about-director {
        margin-top: 20px;
    }
    
    /* Contact Section adjustments */
    .contact-grid {
        flex-direction: column;
        gap: 20px;
    }
    
    /* Footer adjustments */
    .footer-content {
        justify-content: space-around;
        text-align: center;
    }
    .footer-logo, .footer-links, .footer-contact {
        min-width: 150px;
    }
    .footer-bottom {
        justify-content: center;
        flex-direction: column-reverse;
    }
    .social-links {
        margin-bottom: 15px;
    }
}

@media (max-width: 768px) {
    h1 { font-size: 2.2rem; }
    h2 { font-size: 1.8rem; }
    .section-padding {
        padding: 50px 0;
    }

    /* Header Mobile Menu */
    .nav {
        display: flex;
        align-items: center;
    }
    .nav-list {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 70px; /* Below header */
        right: 0;
        width: 100%;
        background-color: var(--color-dark);
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
        padding: 20px 0;
        text-align: center;
        transition: transform 0.3s ease-out;
    }

    .nav-list.active {
        display: flex;
    }

    .nav-list li {
        margin: 10px 0;
    }

    .nav-list .nav-link {
        color: var(--color-white);
        padding: 10px 20px;
        display: block;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    .nav-list .nav-link:hover::after,
    .nav-list .nav-link.active::after {
        background-color: var(--color-accent);
    }
    .nav-list .nav-link::after {
        height: 0;
    }

    .nav-toggle {
        display: block;
        z-index: 10;
    }
    
    .nav-toggle.open .bar:nth-child(1) {
        transform: translateY(8px) rotate(-45deg);
    }
    .nav-toggle.open .bar:nth-child(2) {
        opacity: 0;
    }
    .nav-toggle.open .bar:nth-child(3) {
        transform: translateY(-8px) rotate(45deg);
    }

    /* Gallery adjustments */
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        grid-auto-rows: 150px;
    }
    .gallery-item:nth-child(2n) {
        grid-row: span 1; /* Reset complex masonry on small screens */
    }
    .gallery-item:nth-child(5n) {
        grid-column: span 1; /* Reset complex masonry on small screens */
    }
    
    .contact-form-container {
        min-width: auto;
    }
}