/* General Styles */
:root {
    --primary-color: #4a6cf7;
    --text-color: #333;
    --bg-color: #f0f9ff;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 12px rgba(0,0,0,0.08);
    --card-hover-shadow: 0 12px 25px rgba(0,0,0,0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    min-height: 100vh;
    background-color: var(--bg-color);
    font-family: 'Nunito', sans-serif;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 20px;
    text-align: center;
    flex-grow: 1;
}

/* Language Bar */
.language-bar {
    width: 100%;
    padding: 10px 0;
    text-align: center;
    position: relative;
    z-index: 1000;
}

.language-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 0 1rem 1rem;
    flex-wrap: wrap;
}

.language-selector a {
    padding: 10px 25px;
    border-radius: 25px;
    background: var(--card-bg);
    color: var(--text-color);
    font-weight: bold;
    font-size: 1rem;
    box-shadow: var(--card-shadow);
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.language-selector a.active,
.language-selector a:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 14px rgba(74,108,247,0.2);
}

/* Font specifics */
.language-selector a.lang-ar {
    font-family: 'Tajawal', sans-serif;
}

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 20px;
    padding-top: 1rem;
    transform: translateY(-1rem);
}

.page-header h1 {
    color: #ff6b6b;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin: 0 0 0.5rem 0;
}

.page-header p {
    color: #555;
    font-size: 1.2rem;
    margin: 0;
}

/* RTL Specific Styles */
body.rtl {
    direction: rtl;
    font-family: 'Tajawal', sans-serif;
}

body.rtl .language-bar {
    direction: ltr; /* Keep language bar LTR for consistency */
}

body.rtl .language-selector a.lang-en,
body.rtl .language-selector a.lang-fr {
    font-family: 'Nunito', sans-serif;
}

/* Category Page Title Bar */
.title-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.title-bar h1 {
    margin: 0;
}

.nav-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    text-decoration: none !important;
    transition: background-color 0.3s;
    padding: 0.5rem;
    border-radius: 50%;
}

.nav-icon:hover {
    background-color: rgba(74, 108, 247, 0.1);
}

/* Cards (Shared between index and category) */
.categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    padding: 20px 0;
}

.category-card {
    background-color: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #eef2f7;
}

.categories .category-card:nth-child(even) {
    background-color: #fcfdff;
}

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

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

.category-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background-color: #f0f4f8;
    overflow: hidden;
    border-radius: 15px 15px 0 0;
}

.category-card img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    border-radius: 15px 15px 0 0;
}

.category-default-icon {
    font-size: 4rem;
    color: #4ecdc4;
}

.category-info {
    padding: 1rem;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: rgba(243, 246, 255, 0.3);
    border-top: 1px solid #eef2f7;
}

.category-info h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.subcategory-count {
    font-size: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Common components */
.notification.error {
    color: #fff;
    background: #ff6b6b;
    padding: 16px 24px;
    border-radius: 10px;
    margin: 20px auto;
    font-size: 1.1rem;
    max-width: 480px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 2rem;
    }
    .categories {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 480px) {
    .language-selector {
        flex-wrap: wrap;
        justify-content: center;
    }
    .admin-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    .categories {
        grid-template-columns: 1fr;
    }
}

/* Footer styles */
footer {
    background-color: #333;
    color: white;
    padding: 1.5rem 1rem;
    width: 100%;
    flex-shrink: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column; /* Stack links and copyright */
    align-items: center; /* Center everything horizontally */
    gap: 1rem; /* Space between links and copyright */
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap; /* Allow links to wrap on very small screens */
    gap: 1.5rem;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
    font-size: 0.9rem;
}

.footer-links a:hover {
    opacity: 0.8;
}

.footer-links a.admin-link {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

.footer-links a.admin-link:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    opacity: 1;
}

.copyright {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    text-align: center;
}

/* General link overrides */
a {
    text-decoration: none !important;
}

