/* Main Variables */
:root {
    --primary-color: #20416a;
    --secondary-color: #ff9d00;
    --text-color: #333;
    --bg-color: #f4f7f6;
    --card-bg: #fff;
    --footer-bg: #1a365d;
    --footer-text: #fff;
    --transition-speed: 0.3s;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
}

[data-theme="dark"] {
    --primary-color: #345d8b;
    --secondary-color: #ffaa33;
    --text-color: #e0e0e0;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --footer-bg: #0d1b2a;
    --shadow: 0 4px 6px rgba(255, 255, 255, 0.05);
    --hover-shadow: 0 8px 15px rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color var(--transition-speed), color var(--transition-speed);
    direction: rtl;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-speed);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: bold;
}

.nav-menu {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: var(--text-color);
    font-weight: 500;
    font-size: 1rem;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--secondary-color);
    background-color: rgba(0, 0, 0, 0.03);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    padding: 5px;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.register-btn {
    background-color: var(--secondary-color);
    color: #fff !important;
    padding: 8px 15px;
    border-radius: 20px;
    transition: transform 0.2s;
}

.register-btn:hover {
    transform: scale(1.05);
}

/* Dark Mode Toggle */
.theme-toggle {
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    position: relative;
    width: 40px;
    height: 40px;
    overflow: hidden;
}

.theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
    /* Subtle hover bg */
}

.theme-toggle svg {
    position: absolute;
    width: 22px;
    height: 22px;
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.5s;
}

/* Light Mode State (Moon visible) */
.sun-icon {
    opacity: 0;
    transform: translateY(20px) rotate(45deg);
}

.moon-icon {
    opacity: 1;
    transform: translateY(0) rotate(0);
}

/* Dark Mode State (Sun visible) */
[data-theme="dark"] .sun-icon {
    opacity: 1;
    transform: translateY(0) rotate(0);
}

[data-theme="dark"] .moon-icon {
    opacity: 0;
    transform: translateY(-20px) rotate(-45deg);
}

/* Hero Slider */
.hero-slider {
    position: relative;
    height: 250px;
    /* Compact horizontal rectangle */
    overflow: hidden;
    margin-top: 20px;
    margin-bottom: 40px;
    border-radius: 20px;
    /* Subtle rounding */
    max-width: 1160px;
    /* Match container roughly but slightly different for look */
    margin-left: auto;
    margin-right: auto;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slide.active {
    opacity: 1;
}

.slide-content {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px 40px;
    color: #fff;
    border-radius: var(--border-radius);
    text-align: center;
}

/* Section Titles */
.section-title {
    text-align: center;
    margin-bottom: 40px;
    color: var(--primary-color);
    font-size: 2rem;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 3px;
    background: var(--secondary-color);
    margin: 10px auto 0;
}

/* About Home Section */
.about-home {
    background: var(--card-bg);
    padding: 60px 0;
    margin-bottom: 40px;
    /* border-radius: 20px; */
    /* Removed global radius for full width feel */
}

.about-content {
    display: flex;
    align-items: center;
    gap: 40px;
}

.about-text {
    flex: 1;
}

.about-image {
    flex: 1;
}

.about-image img {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.btn-primary {
    display: inline-block;
    background: var(--primary-color);
    color: #fff;
    padding: 10px 25px;
    border-radius: 5px;
    margin-top: 20px;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: #1a3350;
}

/* Projects Grid */
.projects-app-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 15px;
    margin-bottom: 60px;
}

.project-app-icon {
    text-align: center;
    transition: transform var(--transition-speed);
}

.project-app-icon:hover {
    transform: translateY(-5px);
}

.project-app-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.project-app-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-size: cover;
    background-position: center;
    border-radius: 22%;
    /* App icon style rounding */
    margin-bottom: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.project-app-name {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    word-break: break-word;
}

.verified-icon-small {
    width: 12px;
    height: 12px;
}

.project-card {
    background: var(--card-bg);
    border-radius: 20px;
    /* More rounded as requested */
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
}

.project-thumb {
    height: 200px;
    background-color: #eee;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: flex-end;
    /* Align content to bottom */
    padding: 15px;
}

/* Gradient overlay for text readability on image */
.project-thumb::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    z-index: 1;
}

.project-title-overlay {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    justify-content: flex-start;
    /* Start align */
    align-items: center;
    gap: 8px;
    /* Space between title and badge */
}

.project-title-overlay h4 {
    color: #fff;
    margin: 0;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    flex: initial;
    /* Don't stretch */
}

.category-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--secondary-color);
    color: #fff;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.verified-badge img {
    width: 20px;
    height: 20px;
    margin-right: 5px;
}

.project-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.membership-box {
    text-align: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.membership-label {
    font-size: 0.8rem;
    color: #777;
    display: block;
    margin-bottom: 2px;
}

.membership-id {
    font-family: 'Tajawal', sans-serif;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1rem;
    background: none;
    padding: 0;
    margin: 0;
}

.project-details-row {
    text-align: right;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-details-row img {
    width: 16px;
    opacity: 0.6;
}

.project-desc {
    font-size: 0.9rem;
    color: #555;
    margin: 10px 0;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    /* Allow 4 lines */
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: right;
    flex-grow: 1;
}

.project-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: auto;
    /* Push to bottom */
    padding-top: 15px;
}

.btn-more {
    background: var(--primary-color);
    color: #fff;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 0.9rem;
    flex: 1;
    text-align: center;
}

.btn-whatsapp {
    background: #25D366;
    color: #fff;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 0.9rem;
    flex: 1;
    text-align: center;
}

.project-stats {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 10px 20px;
    color: #888;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: flex-start;
    /* Left aligned or right aligned depending on RTL */
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 60px;
}

/* News Cards */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 60px;
}

.news-card {
    display: block;
    position: relative;
    height: 300px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    color: #fff;
    text-decoration: none;
}

.news-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.news-card:hover .news-bg {
    transform: scale(1.1);
}

.news-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 20px;
}

.news-title {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.btn-news {
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 0.9rem;
}

/* Blog Slider (Horizontal Scroll) */
.blog-scroller {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 20px;
    margin-bottom: 60px;
    scrollbar-width: thin;
}

.blog-card {
    display: flex;
    flex-direction: column;
    min-width: 300px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.blog-img {
    height: 180px;
    background-color: #ddd;
    background-size: cover;
    background-position: center;
}

.blog-content {
    padding: 20px;
}

.blog-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.author-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* WhatsApp Channel */
.whatsapp-channel {
    background: var(--card-bg);
    /* Or green tint */
    padding: 40px;
    text-align: center;
    border-radius: var(--border-radius);
    margin-bottom: 60px;
    border: 2px dashed #25D366;
}

/* Footer */
footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 60px 0 20px;
}

.footer-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-logo {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: 15px;
    display: block;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a:hover {
    color: var(--secondary-color);
}

.copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Forms (Register) */
.form-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
}

.form-note {
    font-size: 0.8rem;
    color: #888;
    margin-top: 5px;
}

/* Projects Page Layout */
.projects-layout {
    display: flex;
    gap: 30px;
    margin-bottom: 60px;
}

.projects-sidebar {
    width: 250px;
    flex-shrink: 0;
}

.filter-box {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    position: sticky;
    top: 100px;
}

.projects-main {
    flex-grow: 1;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .header-inner {
        position: relative;
    }

    .mobile-toggle {
        display: block;
        order: 1;
    }

    .logo-wrapper {
        order: 2;
        flex: 1;
        justify-content: center;
        /* Center logo on mobile if desired, or flex-start */
        justify-content: flex-start;
    }

    .header-actions {
        order: 3;
    }

    .nav-menu {
        position: absolute;
        /* Or fixed to cover screen */
    }

    .nav-links {
        position: fixed;
        top: 70px;
        /* Adjust based on header height */
        right: -100%;
        width: 100%;
        /* Partial width or full */
        max-width: 300px;
        height: calc(100vh - 70px);
        background-color: var(--card-bg);
        flex-direction: column;
        padding: 20px;
        box-shadow: -2px 5px 10px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease-in-out;
        z-index: 999;
        gap: 0;
        overflow-y: auto;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links a {
        display: block;
        padding: 15px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        width: 100%;
        font-size: 1.1rem;
    }

    .register-btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    .hero-slider {
        height: 150px;
        border-radius: 15px;
        margin-bottom: 25px;
        width: 100%;
    }

    .projects-app-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .project-app-name {
        font-size: 0.7rem;
    }

    .verified-icon-small {
        width: 10px;
        height: 10px;
    }

    .slide-content {
        padding: 15px 20px;
        width: 90%;
    }

    .section-title {
        font-size: 1.6rem;
    }

    .about-content {
        flex-direction: column;
        gap: 30px;
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .news-grid,
    .footer-cols {
        grid-template-columns: 1fr;
        /* Single column on mobile */
        gap: 30px;
    }

    .project-card,
    .news-card {
        max-width: 100%;
    }

    .footer-cols {
        text-align: center;
    }

    .container {
        padding: 0 15px;
    }

    /* Make tables scrollable */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .projects-layout {
        flex-direction: column;
    }

    .projects-sidebar {
        width: 100%;
        margin-bottom: 30px;
    }

    .filter-box {
        position: static;
        /* Remove sticky on mobile */
    }
}

@media (max-width: 480px) {
    .register-btn {
        display: none;
        /* Hide 'Register' on very small screens, keep in menu? specific request */
        /* keeping it for now, maybe reduce size */
        display: inline-block;
        font-size: 0.8rem;
        padding: 5px 10px;
    }

    .logo h1 {
        font-size: 1.2rem;
    }
}