﻿/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    /* Palette de couleurs "Algérie Timbre" */
    --primary-color: #CE1126;
    /* Vert profond élégant */
    --primary-light: #e8293d;
    /* Vert plus clair pour hover */
    --secondary-color: #d4af37;
    /* Doré pour les accents/premium */
    --accent-blue: #3498db;
    /* Pour les liens/actions standards */

    /* Couleurs de fond et texte */
    --bg-body: #f4f6f8;
    /* Gris très pâle, moins agressif que le blanc pur */
    --bg-card: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #636e72;
    --border-color: #e9ecef;

    /* Ombres et arrondis */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
}

/* Hide mobile-only elements by default */
.mobile-sidebar-toggle,
.mobile-sidebar-close {
    display: none;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    /* Fallback solide */
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
}

/* Scrollbar personnalisée globale */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* =========================================
   2. NAVIGATION (NAVBAR)
   ========================================= */
.navbar {
    background: var(--bg-card);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border-bottom: 3px solid var(--primary-color);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    height: 70px;
    gap: 20px;
}

/* Logo */
.nav-brand {
    font-weight: bold;
    font-size: 1.3rem;
    color: var(--primary-color);
    text-decoration: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand:hover {
    color: var(--primary-light);
}

.nav-links {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-link {
    color: var(--text-main);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 50px;
    /* Style "Pill" plus moderne */
    font-weight: 500;
    transition: var(--transition);
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 98, 51, 0.2);
}

/* Menu Hamburger */
.menu-icon {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    cursor: pointer;
    z-index: 1002;
}

.menu-icon span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--primary-color);
    border-radius: 3px;
    transition: var(--transition);
}

/* =========================================
   3. LAYOUT PRINCIPAL
   ========================================= */
.main-container {
    display: flex;
    flex: 1;
    max-width: 1440px;
    margin: 30px auto;
    padding: 0 20px;
    gap: 30px;
}

.main-content {
    flex: 1;
    min-width: 0;
    overflow: visible;
    /* Permet au contenu de s'afficher sur toute la largeur */
}

/* =========================================
   4. SIDEBAR & FILTRES
   ========================================= */
.sidebar {
    flex: 0 0 260px;
    background: transparent;
    /* Plus léger visuellement */
    padding: 0;
}

.sidebar h2 {
    color: var(--primary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 15px;
    margin-top: 25px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--secondary-color);
    font-weight: 700;
}

/* Conteneur de liens sidebar amélioré */
.scroll-container,
.categories-scroll {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.sidebar ul,
.scroll-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar ul li a,
.category-item {
    color: var(--text-main);
    text-decoration: none;
    display: block;
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.95rem;
    border-left: 3px solid transparent;
}

.sidebar ul li a:hover,
.category-item:hover {
    background-color: white;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    padding-left: 20px;
    /* Petit effet de mouvement */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* =========================================
   5. BANNÈRE & HERO (Timbre du jour)
   ========================================= */
.header-section {
    margin-bottom: 40px;
}

.welcome-banner {
    background: linear-gradient(135deg, var(--primary-color), #7a0a17);
    color: white;
    padding: 8px 15px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

/* Motif subtil en fond (optionnel) */
.welcome-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
}

.welcome-banner h1 {
    font-size: 1rem;
    margin-bottom: 2px;
    font-weight: 600;
}

.welcome-banner p {
    margin: 2px 0 0 0;
    font-size: 0.8rem;
    opacity: 0.9;
}

.stats-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 15px;
    border-radius: 50px;
    display: inline-flex;
    backdrop-filter: blur(5px);
    font-size: 0.85rem;
}

/* Timbre vedette */
.featured-stamp {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 0;
    /* Padding géré par le flex */
    margin: 30px 0;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.featured-stamp h2 {
    background: #f8f9fa;
    margin: 0;
    padding: 15px 25px;
    font-size: 1.1rem;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
}

.featured-stamp-content {
    display: flex;
    padding: 25px;
    gap: 30px;
    align-items: flex-start;
}

.featured-stamp-image {
    flex: 0 0 220px;
    background: #f0f2f5;
    padding: 15px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.featured-stamp-image img {
    max-width: 100%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.featured-stamp-info h3 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.view-details {
    background: var(--secondary-color);
    color: white;
    padding: 10px 24px;
    border-radius: 30px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(212, 175, 55, 0.3);
    border: none;
    display: inline-block;
    margin-top: 15px;
}

.view-details:hover {
    background: #c5a028;
    transform: translateY(-2px);
}

/* =========================================
   6. GRILLE DES TIMBRES (MODERNE)
   ========================================= */
.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 3 timbres par ligne */
    gap: 25px;
    padding: 0;
}

.stamp-card {
    background: var(--bg-card);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 0;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.stamp-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(0, 98, 51, 0.2);
}

/* Conteneur image agrandi */
.stamp-image-container {
    width: 100%;
    height: 200px;
    /* Hauteur fixe pour alignement */
    background-color: #f8f9fa;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    border-bottom: 1px solid #f0f0f0;
}

.stamp-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 160px;
    /* Laisse respirer l'image */
    object-fit: contain;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.stamp-card:hover .stamp-image {
    transform: scale(1.05);
}

.stamp-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.stamp-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: var(--text-main);
    line-height: 1.3;
}

.stamp-country {
    color: var(--secondary-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 10px;
}

.stamp-views {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
    /* Aligner à gauche */
}

.stamp-age {
    color: var(--primary-color);
    font-weight: 600;
}

.stamp-view-count {
    color: var(--text-muted);
}

/* =========================================
   7. PAGINATION & ELEMENTS DIVERS
   ========================================= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: var(--transition);
}

.pagination a:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.pagination .active {
    background: linear-gradient(135deg, var(--primary-color), #e8293d);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 98, 51, 0.4);
}

.pagination .disabled {
    background: #f8f9fa;
    border-color: #e9ecef;
    color: #c0c0c0;
    cursor: not-allowed;
    box-shadow: none;
}

.pagination .disabled:hover {
    transform: none;
    background: #f8f9fa;
    border-color: #e9ecef;
    color: #c0c0c0;
}

/* =========================================
   YEARS GRID (Page Années)
   ========================================= */
.years-grid {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.year-card {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 25px 12px;
    text-decoration: none;
    color: var(--text-main);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    min-height: 110px;
    min-width: 0;
    overflow: hidden;
}

.year-card:hover {
    background: linear-gradient(135deg, var(--primary-color), #e8293d);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.year-card:hover .year-info h2,
.year-card:hover .year-info p {
    color: white;
}

.year-info {
    text-align: center;
}

.year-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: var(--primary-color);
    transition: var(--transition);
}

.year-info p {
    font-size: 0.8rem;
    margin: 0;
    color: var(--secondary-color);
    transition: var(--transition);
}

/* Responsive pour years-grid */
@media (max-width: 1024px) {
    .years-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .years-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .years-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .year-card {
        padding: 15px;
        min-height: 80px;
    }

    .year-info h2 {
        font-size: 1.4rem;
    }
}

/* Admin Grid */
.admin-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.admin-card {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.admin-card:hover {
    box-shadow: var(--shadow-hover);
}

.admin-card-icon {
    background: rgba(52, 152, 219, 0.1);
    color: var(--accent-blue);
}

/* =========================================
   8. RESPONSIVE DESIGN
   ========================================= */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
        padding: 0 15px;
    }

    .sidebar {
        flex: none;
        width: 100%;
        margin-bottom: 20px;
    }

    /* La sidebar devient horizontale sur tablette/mobile si voulu, 
       sinon on la garde verticale mais fluide */
    .scroll-container {
        max-height: 250px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        justify-content: space-between;
        /* Garde le logo à gauche et burger à droite */
    }

    .menu-icon {
        display: flex;
        order: 2;
        /* Burger à droite */
    }

    /* HIDE SIDEBARS ON MOBILE - Show main content first */
    .sidebar {
        display: none !important;
    }

    /* When sidebar is toggled visible */
    .sidebar.mobile-visible {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1001;
        background: var(--bg-body);
        overflow-y: auto;
        padding: 20px;
        padding-top: 70px;
    }

    /* Main content takes full width */
    .main-container {
        flex-direction: column;
        padding: 0 10px;
    }

    .main-content {
        width: 100%;
        order: 1;
    }

    /* Styles pour le menu mobile déroulant */
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: white;
        flex-direction: column;
        align-items: center;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease-in-out;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        border-top: 1px solid #eee;
    }

    .nav-links.show {
        max-height: 500px;
    }

    .nav-link {
        width: 100%;
        text-align: center;
        border-radius: 0;
        padding: 15px 0;
        color: var(--text-main);
        border-bottom: 1px solid #f5f5f5;
    }

    .nav-link:hover {
        background-color: #f8f9fa;
        color: var(--primary-color);
        box-shadow: none;
    }

    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .featured-stamp-content {
        flex-direction: column;
        text-align: center;
    }

    .featured-stamp-image {
        width: 100%;
        flex: none;
    }

    .view-details {
        width: 100%;
        text-align: center;
    }

    /* Mobile sidebar toggle button */
    .mobile-sidebar-toggle {
        display: flex !important;
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        background: var(--primary-color);
        color: white;
        border: none;
        border-radius: 50%;
        font-size: 1.3rem;
        cursor: pointer;
        z-index: 1000;
        box-shadow: 0 4px 15px rgba(0, 98, 51, 0.4);
        align-items: center;
        justify-content: center;
        transition: var(--transition);
    }

    .mobile-sidebar-toggle:hover {
        background: var(--primary-light);
        transform: scale(1.1);
    }

    /* Close button for mobile sidebar */
    .mobile-sidebar-close {
        display: block !important;
        position: fixed;
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        background: var(--primary-color);
        color: white;
        border: none;
        border-radius: 50%;
        font-size: 1.2rem;
        cursor: pointer;
        z-index: 1002;
    }

    /* Footer mobile adjustments */
    .footer-container {
        grid-template-columns: 1fr;
        padding: 30px 15px;
        gap: 25px;
    }

    /* Auth links mobile */
    .auth-links {
        display: none;
    }
}

@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: 1fr;
    }

    .welcome-banner h1 {
        font-size: 1.5rem;
    }

    .stats-container {
        flex-direction: column;
        gap: 15px;
    }
}

/* =========================================
   9. SEARCH BAR & SEARCH PAGE
   ========================================= */
.nav-search {
    flex: 0 1 250px;
    margin: 0 15px;
}

.search-form {
    display: flex;
    align-items: center;
    background: var(--bg-body);
    border-radius: 50px;
    padding: 5px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.search-form:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 98, 51, 0.1);
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 15px;
    font-size: 0.9rem;
    outline: none;
    color: var(--text-main);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--primary-light);
}

/* Search Page Specific */
.search-form-container {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
}

.search-form-large {
    max-width: 800px;
    margin: 0 auto;
}

.search-inputs {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.search-field {
    flex: 1;
    min-width: 200px;
}

.search-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
}

.search-field input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
}

.search-field input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-submit {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.search-submit:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

.search-results-info {
    background: #e8f5e9;
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
}

.no-results i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: var(--border-color);
}

.search-suggestions {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius-lg);
    text-align: center;
}

.search-suggestions h2 {
    color: var(--text-main);
    margin-bottom: 20px;
}

.suggestion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.suggestion-tag {
    display: inline-block;
    padding: 10px 20px;
    background: var(--bg-body);
    color: var(--text-main);
    text-decoration: none;
    border-radius: 50px;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.suggestion-tag:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* =========================================
   10. FOOTER
   ========================================= */
.site-footer {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #b8b8d0;
    margin-top: 60px;
    padding: 0;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 50px 30px 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 40px;
}

.footer-section h3 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 25px;
    position: relative;
    padding-bottom: 10px;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 3px;
    background: var(--secondary-color);
    border-radius: 2px;
}

.footer-section p {
    line-height: 1.7;
    font-size: 0.95rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: #b8b8d0;
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: var(--secondary-color);
    padding-left: 5px;
}

.footer-links i {
    margin-right: 10px;
    color: var(--secondary-color);
}

.social-links {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--secondary-color);
    transform: translateY(-3px);
}

.footer-bottom {
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
}

.footer-bottom p {
    margin: 5px 0;
}

/* =========================================
   11. STAMP DETAILS PAGE
   ========================================= */
.stamp-details-container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.stamp-header {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.stamp-image-detail {
    flex: 0 0 300px;
}

.stamp-image-detail img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.stamp-title-section {
    flex: 1;
}

.stamp-title-section h1 {
    margin: 0 0 15px 0;
    color: var(--primary-color);
    font-size: 1.8rem;
}

.stamp-meta {
    color: var(--text-muted);
    font-size: 1.05em;
    line-height: 1.8;
}

.stamp-meta p {
    margin: 8px 0;
}

.stamp-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.detail-group {
    margin-bottom: 15px;
}

.detail-label {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    color: var(--text-main);
    line-height: 1.6;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    margin-bottom: 20px;
    transition: var(--transition);
}

.back-button:hover {
    background: var(--primary-light);
    transform: translateX(-3px);
}

/* Social Share */
.social-share {
    margin: 40px 0;
    text-align: center;
    padding: 30px;
    background: var(--bg-body);
    border-radius: var(--radius-md);
}

.social-share-title {
    margin-bottom: 20px;
    color: var(--text-muted);
    font-size: 1.1em;
}

.social-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.share-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.share-button:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.facebook-share {
    background: #1877f2;
}

.whatsapp-share {
    background: #25D366;
}

.twitter-share {
    background: #000000;
}

.tiktok-share {
    background: #000000;
}

.visits-counter {
    margin-top: 30px;
    text-align: center;
    color: var(--text-muted);
    padding: 15px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
}

/* =========================================
   12. QUIZ PAGE
   ========================================= */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.quiz-container h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 30px;
}

.timbre-image {
    max-width: 300px;
    margin: 20px auto;
    display: block;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.quiz-message {
    padding: 15px 20px;
    margin: 15px 0;
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 500;
}

.quiz-message.succes {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.quiz-message.erreur {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.quiz-message.indice {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.quiz-stats {
    display: flex;
    justify-content: space-around;
    margin: 25px 0;
    padding: 20px;
    background: var(--bg-body);
    border-radius: var(--radius-md);
}

.quiz-stat-item {
    text-align: center;
}

.quiz-stat-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--primary-color);
}

.quiz-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.quiz-form {
    text-align: center;
    margin-top: 30px;
}

.quiz-input {
    padding: 12px 20px;
    margin: 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    width: 150px;
    text-align: center;
}

.quiz-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.quiz-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    margin: 5px;
    transition: var(--transition);
}

.quiz-btn-primary {
    background: var(--primary-color);
    color: white;
}

.quiz-btn-primary:hover {
    background: var(--primary-light);
}

.quiz-btn-hint {
    background: #f39c12;
    color: white;
}

.quiz-btn-hint:hover:not(:disabled) {
    background: #d68910;
}

.quiz-btn-hint:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quiz-btn-reset {
    background: #e74c3c;
    color: white;
}

.quiz-btn-reset:hover {
    background: #c0392b;
}

.timbre-info-quiz {
    text-align: center;
    margin: 20px 0;
}

.timbre-info-quiz h2 {
    color: var(--text-main);
    margin-bottom: 10px;
}

.timbre-info-quiz .description {
    font-style: italic;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* =========================================
   13. DEFINITIONS PAGE
   ========================================= */
.definitions-container {
    padding: 20px 0;
}

.definition-card {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.definition-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.definition-image {
    width: 280px;
    min-height: 220px;
    flex-shrink: 0;
    background: var(--bg-body);
}

.definition-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.definition-info {
    flex: 1;
    padding: 25px;
    display: flex;
    flex-direction: column;
}

.definition-info h2 {
    margin: 0 0 15px 0;
    color: var(--primary-color);
    font-size: 1.4em;
}

.definition-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 0.9em;
}

.definition-metadata .category {
    background: var(--primary-color);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.85em;
}

.definition-excerpt {
    flex: 1;
    line-height: 1.7;
    color: var(--text-main);
    margin-bottom: 20px;
}

.definition-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: var(--bg-body);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.read-more {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
}

.read-more:hover {
    color: var(--primary-light);
}

.add-button {
    display: inline-block;
    padding: 10px 20px;
    background: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    margin-top: 15px;
    font-weight: 600;
    transition: var(--transition);
}

.add-button:hover {
    background: #c5a028;
    transform: translateY(-2px);
}

/* Responsive adjustments for new sections */
@media (max-width: 768px) {
    .nav-search {
        display: none;
    }

    .stamp-header {
        flex-direction: column;
    }

    .stamp-image-detail {
        flex: none;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .stamp-details-grid {
        grid-template-columns: 1fr;
    }

    .social-buttons {
        flex-direction: column;
        align-items: center;
    }

    .share-button {
        width: 200px;
        justify-content: center;
    }

    .definition-card {
        flex-direction: column;
    }

    .definition-image {
        width: 100%;
        height: 200px;
    }

    .quiz-stats {
        flex-wrap: wrap;
        gap: 20px;
    }

    .quiz-stat-item {
        flex: 0 0 45%;
    }

    .search-inputs {
        flex-direction: column;
    }

    .search-field {
        width: 100%;
    }

    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-section h3::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .social-links {
        justify-content: center;
    }
}

/* =========================================
   12. STATS DASHBOARD
   ========================================= */
.stats-dashboard-section {
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    border: 1px solid #eef2f7;
}

.stats-dashboard-section h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.4rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.stats-summary {
    margin-top: 10px;
    padding: 20px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stats-card {
    text-align: center;
    padding: 25px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    border: 1px solid #eef2f7;
    transition: transform 0.3s;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.05);
}

.stats-card h3 {
    font-size: 1rem;
    color: #7f8c8d;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-card .value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
}

.featured-stat-card {
    display: flex;
    align-items: center;
    gap: 30px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fcf9 100%);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid rgba(0, 98, 51, 0.1);
    box-shadow: 0 10px 25px rgba(0, 98, 51, 0.05);
}

.featured-stat-image {
    flex: 0 0 180px;
    text-align: center;
}

.featured-stat-image img {
    max-width: 100%;
    max-height: 180px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #fff;
}

.featured-stat-content {
    flex: 1;
}

.featured-stat-badge {
    display: inline-block;
    background: var(--secondary-color);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.featured-stat-title {
    font-size: 1.8rem;
    margin: 0 0 10px 0;
    color: var(--primary-color);
}

.featured-stat-meta {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.featured-stat-data {
    display: flex;
    gap: 30px;
}

.stat-data-item {
    display: flex;
    flex-direction: column;
}

.stat-data-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-data-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

.stats-table,
.geo-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
}

.stats-table th,
.stats-table td,
.geo-table th,
.geo-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eef2f7;
}

.stats-table th,
.geo-table th {
    background-color: #f8f9fa;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.stats-table th:first-child,
.geo-table th:first-child {
    border-top-left-radius: 8px;
}

.stats-table th:last-child,
.geo-table th:last-child {
    border-top-right-radius: 8px;
}

.stats-table tr:hover td,
.geo-table tr:hover td {
    background-color: #fcfcfc;
}

.thumbnail {
    width: 60px !important;
    height: 60px !important;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #eee;
    background: #fff;
    padding: 2px;
}

.stats-table img {
    max-width: 60px;
    height: auto;
}

.view-count {
    font-weight: bold;
    color: var(--primary-color);
    background: rgba(0, 98, 51, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
    display: inline-block;
}

.rank {
    font-weight: bold;
    color: #95a5a6;
    text-align: center;
    width: 50px;
}

.time {
    color: #7f8c8d;
    font-family: monospace;
    font-size: 0.95em;
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
    margin-top: 20px;
}

.error-message {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
    background-color: #f8d7da;
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: #95a5a6;
    font-style: italic;
}

.stats-split-section {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 900px) {
    .stats-split-section {
        grid-template-columns: 1fr;
    }

    .featured-stat-card {
        flex-direction: column;
        text-align: center;
    }
}

/* Geography Progress Bars */
.geo-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.geo-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.geo-flag {
    width: 30px;
    text-align: center;
    font-size: 1.2rem;
}

.geo-info {
    flex: 1;
}

.geo-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.geo-country {
    font-weight: 600;
    color: var(--text-main);
}

.geo-count {
    color: var(--primary-color);
    font-weight: 700;
}

.geo-progress-bg {
    height: 8px;
    background: #eef2f7;
    border-radius: 4px;
    overflow: hidden;
}

.geo-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
    transition: width 1s ease-out;
}

/* =========================================
   ENHANCED ANALYTICS STYLES
   ========================================= */

/* Device Statistics */
.device-stats-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.device-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.device-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #eef2f7;
    transition: all 0.3s ease;
}

.device-legend-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.device-legend-item i {
    font-size: 1.4rem;
    color: var(--primary-color);
}

.device-label {
    font-weight: 600;
    color: var(--text-main);
}

.device-percent {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.device-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Traffic Source Statistics */
.source-stats-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.source-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.source-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.source-info {
    flex: 1;
}

.source-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.source-label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.source-percent {
    font-weight: 700;
    font-size: 1.1rem;
}

.source-progress-bg {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.source-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s ease-out;
}

.source-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Browser Grid */
.browser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.browser-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid #eef2f7;
}

.browser-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.browser-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.browser-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.browser-count {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.browser-bar-bg {
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}

.browser-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    transition: width 0.8s ease-out;
}

/* Responsive adjustments for analytics */
@media (max-width: 768px) {
    .device-legend {
        flex-direction: column;
    }

    .device-legend-item {
        justify-content: center;
    }

    .browser-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .source-item {
        padding: 10px 12px;
    }

    .source-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
}

/* =========================================
   18. RTL SUPPORT (ARABIC)
   ========================================= */
[dir="rtl"] body {
    text-align: right;
}

[dir="rtl"] .nav-container {
    flex-direction: row-reverse;
}

[dir="rtl"] .nav-links {
    margin-right: auto !important;
    margin-left: 0 !important;
    flex-direction: row-reverse;
}

[dir="rtl"] .sidebar {
    text-align: right;
}

[dir="rtl"] .sidebar ul li {
    padding-right: 0;
}

[dir="rtl"] .main-container {
    flex-direction: row-reverse;
}

[dir="rtl"] .footer-container {
    direction: rtl;
}

[dir="rtl"] .footer-section {
    text-align: right;
}

[dir="rtl"] .stamp-card {
    text-align: right;
}

[dir="rtl"] .back-button i {
    transform: rotate(180deg);
}

[dir="rtl"] .nav-button-item i.fa-chevron-left,
[dir="rtl"] .nav-button-item i.fa-chevron-right {
    transform: rotate(180deg);
}

[dir="rtl"] .search-btn {
    border-radius: 8px 0 0 8px;
    border-left: 1px solid var(--border-color);
    border-right: none;
}

[dir="rtl"] .search-input {
    border-radius: 0 8px 8px 0;
    padding: 0 15px 0 45px;
}

/* =========================================
   17. BREADCRUMBS (SEO Navigation)
   ========================================= */
.breadcrumbs {
    background: var(--bg-card);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid var(--primary-color);
}

.breadcrumbs ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
}

.breadcrumbs li {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breadcrumbs li:not(:last-child)::after {
    content: '›';
    margin: 0 10px;
    color: var(--border-color);
    font-size: 1.1rem;
    font-weight: bold;
}

.breadcrumbs a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
    padding: 2px 0;
}

.breadcrumbs a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.breadcrumbs .current {
    color: var(--text-main);
    font-weight: 600;
}

/* RTL support for breadcrumbs */
[dir="rtl"] .breadcrumbs {
    border-left: none;
    border-right: 3px solid var(--primary-color);
}

[dir="rtl"] .breadcrumbs ol {
    flex-direction: row-reverse;
}

[dir="rtl"] .breadcrumbs li:not(:last-child)::after {
    content: '‹';
}

/* Mobile responsive breadcrumbs */
@media (max-width: 576px) {
    .breadcrumbs {
        padding: 10px 15px;
    }

    .breadcrumbs li {
        font-size: 0.85rem;
    }

    .breadcrumbs li:not(:last-child)::after {
        margin: 0 6px;
    }
}