/* ========================================
   SRM Casablanca-Settat - Interface Pro v3
   Version: 20260130_192732
   Option 2 : Logo --- ligne --- Compteur
   ======================================== */

:root {
    --primary: #2196C9;
    --primary-dark: #1976A8;
    --green: #43A047;
    --green-dark: #2E7D32;
    --orange: #F5871F;
    --gray-dark: #5F6368;

    --bg: #F5F7FA;
    --white: #FFFFFF;
    --text: #1A1A1A;
    --text-secondary: #5F6368;
    --border: #E0E4E8;

    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background */
body::before {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('Background.png');
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: 100% auto;
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
}

.page-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   Hero Banner
   ======================================== */

.hero-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--green-dark) 100%);
    position: relative;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('zelij-background.png');
    background-repeat: repeat;
    background-size: 250px;
    opacity: 0.08;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 1500px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo-box {
    flex-shrink: 0;
}

.logo {
    height: 100px;
    width: auto;
    background: white;
    padding: 6px 10px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.hero-center {
    flex: 1;
    text-align: center;
}

.title-fr {
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.title-ar {
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
    font-weight: 600;
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.postes-box {
    flex-shrink: 0;
    background: linear-gradient(160deg, #ffffff 0%, #f0f8fd 40%, #dceef8 100%);
    border-radius: 14px;
    padding: 0.95rem 1.7rem;
    box-shadow:
        0 12px 32px rgba(0,0,0,0.3),
        0 4px 12px rgba(0,0,0,0.2),
        0 1px 3px rgba(0,0,0,0.15),
        inset 0 3px 0 rgba(255,255,255,1),
        inset 0 -3px 6px rgba(0,0,0,0.08);
    border: 2px solid rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transform: translateY(-4px);
}

.count-plus {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--green);
    line-height: 1;
}

.count-number {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.count-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
    margin-left: 0.25rem;
}

/* ========================================
   Main Content
   ======================================== */

.main-content {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

/* ========================================
   Info + Map Section (two columns)
   ======================================== */

.info-map-section {
    display: flex;
    gap: 0;
    background: rgba(255, 255, 255, 0.80);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    overflow: hidden;
}

/* Left column : text carousel */
.info-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 0.6rem 1.5rem 0.5rem;
    border-right: 1px solid var(--border);
}

.info-col-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.lang-toggle {
    display: flex;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
}

.lang-option {
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.lang-option.active {
    background: var(--primary);
    color: white;
    border-radius: 20px;
}

.info-carousel {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 160px;
}

.carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    visibility: hidden;
    display: flex;
    align-items: center;
}

.carousel-slide.active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.carousel-slide .slide-content {
    width: 100%;
}

.slide-content h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.6rem;
}

.slide-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 0.5rem;
}

.slide-content p:last-child {
    margin-bottom: 0;
}

.slide-content strong {
    color: var(--primary);
}

.slide-content .slide-cta {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
}

.slide-content .slide-cta strong {
    font-size: 0.82rem;
    color: var(--green);
}

/* Arabic slides */
.slide-ar {
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    text-align: right;
}

.slide-ar p {
    font-size: 0.95rem;
}

.slide-ar h3 { color: var(--green); }
.slide-ar strong { color: var(--green); }
.slide-ar .slide-cta strong { color: var(--primary); }

/* Quote slide */
.slide-quote blockquote {
    font-size: 0.83rem;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.75;
    margin: 0 0 0.5rem;
    padding-left: 1rem;
    border-left: 3px solid var(--primary);
}

.slide-ar .slide-quote blockquote,
.slide-ar.slide-quote blockquote {
    padding-left: 0;
    padding-right: 1rem;
    border-left: none;
    border-right: 3px solid var(--green);
}

.quote-author {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--primary);
    margin-bottom: 0.4rem;
}

.slide-ar .quote-author { color: var(--green); }

/* Nav (arrows + dots) */
.info-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.carousel-arrow {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.carousel-arrow:hover {
    background: var(--primary);
    color: white;
}

.carousel-dots {
    display: flex;
    gap: 0.4rem;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: var(--border);
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
}

.carousel-dot.active {
    background: var(--primary);
    width: 20px;
    border-radius: 4px;
}

/* Right column : Map */
.map-col {
    flex: 0.7;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem 0.5rem;
    background: linear-gradient(180deg, rgba(248,251,253,0.5) 0%, transparent 100%);
}

.map-col-title {
    text-align: center;
    margin-bottom: 0.25rem;
}

.map-col-title .map-title-fr {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
}

.map-col-title .map-title-ar {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--green);
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.map-container {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-container svg {
    width: 100%;
    height: auto;
    max-height: 100%;
    display: block;
}

.map-container .province-path {
    cursor: pointer;
    transition: fill 0.2s, opacity 0.2s;
}

.map-container .province-path:hover {
    fill: #1a9e95;
    filter: brightness(0.9);
}

/* Map Tooltip */
.map-tooltip {
    position: fixed;
    z-index: 2000;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    padding: 0;
    pointer-events: none;
    display: none;
    min-width: 240px;
    max-width: 300px;
    overflow: hidden;
}

.map-tooltip.visible { display: block; }

.map-tooltip-header {
    background: var(--primary);
    color: white;
    padding: 0.6rem 0.9rem;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.map-tooltip-count {
    background: rgba(255,255,255,0.2);
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
}

.map-tooltip-body { padding: 0.5rem 0.9rem 0.7rem; }

.map-tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.78rem;
    border-bottom: 1px solid var(--border);
}

.map-tooltip-row:last-child { border-bottom: none; }

.map-tooltip-label {
    color: var(--text);
    font-weight: 500;
}

.map-tooltip-nb {
    font-weight: 700;
    color: var(--primary);
    background: rgba(33, 150, 201, 0.1);
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    font-size: 0.72rem;
    min-width: 1.6rem;
    text-align: center;
}

.map-tooltip-more {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    padding-top: 0.3rem;
    font-style: italic;
}

/* ========================================
   Selection Section
   ======================================== */

.selection-section {
    margin-bottom: 1rem;
}

.section-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.section-title-ar {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 1rem;
    color: var(--text-secondary);
    direction: rtl;
}

/* ========================================
   Search Bar
   ======================================== */

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 48px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    outline: none;
    transition: all 0.25s ease;
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(33, 150, 201, 0.15);
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-suggestions.active {
    display: block;
}

.suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f0f7fb;
}

.suggestion-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}

.suggestion-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 0.75rem;
}

.suggestion-badge.blue {
    background: rgba(33, 150, 201, 0.12);
    color: var(--primary);
}

.suggestion-badge.green {
    background: rgba(67, 160, 71, 0.12);
    color: var(--green);
}

.suggestion-badge.orange {
    background: rgba(245, 135, 31, 0.12);
    color: var(--orange);
}

.suggestion-badge.gray {
    background: rgba(95, 99, 104, 0.12);
    color: var(--gray-dark);
}

.search-no-result {
    padding: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ========================================
   Segments Grid
   ======================================== */

.segments-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

/* ========================================
   Segment Cards
   ======================================== */

.segment-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: all 0.25s ease;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
}

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

.segment-card.blue { border-top: 4px solid var(--primary); }
.segment-card.blue:hover { border-color: var(--primary); }

.segment-card.green { border-top: 4px solid var(--green); }
.segment-card.green:hover { border-color: var(--green); }

.segment-card.orange { border-top: 4px solid var(--orange); }
.segment-card.orange:hover { border-color: var(--orange); }

.segment-card.gray { border-top: 4px solid var(--gray-dark); }
.segment-card.gray:hover { border-color: var(--gray-dark); }

.card-level {
    padding: 1rem 1.25rem 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.card-level-ar {
    padding: 0.1rem 1.25rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    text-align: right;
}

.card-desc {
    padding: 0.5rem 1.25rem 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex: 1;
}

.card-desc-ar {
    padding: 0.1rem 1.25rem 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    text-align: right;
    opacity: 0.8;
}

.card-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
    transition: all 0.2s;
}

.card-action span:first-child {
    flex-shrink: 0;
}

.card-action-ar {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 0.8rem;
    opacity: 0.7;
    direction: rtl;
}

.card-action svg {
    margin-left: auto;
    flex-shrink: 0;
}

.segment-card.green .card-action { color: var(--green); }
.segment-card.orange .card-action { color: var(--orange); }
.segment-card.gray .card-action { color: var(--gray-dark); }

.segment-card:hover .card-action svg {
    transform: translateX(4px);
}

/* ========================================
   Footer
   ======================================== */

.footer {
    background: transparent;
    border-top: none;
    padding: 1rem 2rem;
    text-align: center;
}

.footer p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.footer-ar {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    direction: rtl;
    margin-top: 0.25rem;
}

/* ========================================
   Modal
   ======================================== */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 550px;
    max-height: 85vh;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: var(--primary);
    color: white;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.modal-title-ar {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.85;
    direction: rtl;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255,255,255,0.25);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

/* Items list */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.item-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.item-card:hover {
    border-color: var(--primary);
    background: white;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.modal[data-color="green"] .item-card:hover {
    border-color: var(--green);
}

.modal[data-color="orange"] .item-card:hover {
    border-color: var(--orange);
}

.modal[data-color="gray"] .item-card:hover {
    border-color: var(--gray-dark);
}

.item-info h4 {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
}

.item-info-ar {
    display: block;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    direction: rtl;
    text-align: right;
    margin-top: 0.15rem;
}

.item-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.item-action-ar {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 0.8rem;
    opacity: 0.7;
    direction: rtl;
}

.modal[data-color="green"] .item-action {
    color: var(--green);
}

.modal[data-color="orange"] .item-action {
    color: var(--orange);
}

.modal[data-color="gray"] .item-action {
    color: var(--gray-dark);
}

.item-action svg {
    transition: transform 0.2s;
}

.item-card:hover .item-action svg {
    transform: translateX(4px);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 1200px) {
    .segments-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .info-map-section {
        flex-direction: column;
    }

    .info-col {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .map-col {
        padding: 1rem;
    }

    .segments-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-content {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .hero-center {
        order: 3;
        width: 100%;
    }

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

    .title-ar {
        font-size: 0.95rem;
    }

    .section-title {
        flex-direction: column;
        gap: 0.25rem;
    }
}

@media (max-width: 600px) {
    .segments-grid {
        grid-template-columns: 1fr;
    }

    .hero-content {
        padding: 1.25rem 1rem;
    }

    .logo {
        height: 65px;
    }

    .count-number {
        font-size: 1.75rem;
    }

    .main-content {
        padding: 1.5rem 1rem;
    }

    .title-fr {
        font-size: 1rem;
    }

    .title-ar {
        font-size: 0.9rem;
    }
}
