/*
Theme Name: Tribus du Maroc
Theme URI: https://tribusdumaroc.com
Author: Tribus du Maroc
Description: Custom theme for Tribus du Maroc
Version: 1.0
*/

:root {
    /* Moroccan Theme Colors */
    --primary: #C1272D;
    /* Moroccan Red */
    --primary-dark: #8a1c20;
    --secondary: #006233;
    /* Moroccan Green */
    --accent: #D4AF37;
    /* Gold */
    --bg-main: #fcfbf4;
    --bg-card: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #5a6c7d;
    --border: #e0e0e0;
    --shadow: rgba(193, 39, 45, 0.08);
}

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

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    padding: 2rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('assets/images/pattern.png');
    opacity: 0.3;
    background-size: 100px;
}

header.scrolled {
    padding: 0.5rem 0;
    background: var(--primary-dark);
}

header.scrolled h1 {
    font-size: 1rem;
    margin-bottom: 0;
}

header.scrolled .header-icon {
    height: 40px;
}

header.scrolled nav {
    margin-top: 0.5rem;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
}

h1 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    transition: all 0.3s ease;
}

.header-icon {
    height: 70px;
    width: auto;
    transition: all 0.3s ease;
}

nav {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    transition: all 0.3s ease;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-btn.active {
    background: var(--accent);
    border-color: var(--accent);
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Map View */
.map-layout {
    display: flex;
    gap: 1.5rem;
    height: 75vh;
}

.sidebar {
    flex: 0 0 300px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
}

.sidebar-header {
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
}

.search-box,
.filter-select {
    flex: 1;
    width: auto;
    min-width: 0;
    padding: 0.6rem;
    margin-bottom: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'Cairo', sans-serif;
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.tribe-item {
    padding: 0.8rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 6px;
    text-align: right;
}

.tribe-item:hover,
.tribe-item.active {
    background: #f0f7f4;
    /* Light green tint */
    border-right: 3px solid var(--secondary);
}

.tribe-name-ar {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.tribe-name-fr {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.tribe-meta {
    font-size: 0.8rem;
    color: #777;
    margin-top: 0.2rem;
}

.map-wrapper {
    flex: 1;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border);
    position: relative;
}

.reset-btn {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.6rem;
    background: var(--text-secondary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.reset-btn:hover {
    background: var(--text-primary);
}

#map {
    width: 100%;
    height: 100%;
}

/* Stats */
.stats-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
    flex: 1;
    min-width: 150px;
    text-align: center;
    border-top: 4px solid var(--secondary);
}

.stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    text-align: right;
}

.close-modal {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

/* Contribute Form */
.form-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow);
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'Cairo', sans-serif;
}

.btn {
    background: var(--secondary);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-family: 'Cairo', sans-serif;
}

.btn:hover {
    background: #004d28;
}

/* List View & Cards */
.tribe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.tribe-card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow);
    overflow: hidden;
    transition: transform 0.2s;
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    text-align: right;
}

.tribe-card:hover {
    transform: translateY(-5px);
    border-color: var(--secondary);
}

.tribe-card-header {
    padding: 1rem;
    color: white;
}

.tribe-card-body {
    padding: 1rem;
    flex: 1;
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('assets/images/pattern.png');
    opacity: 0.3;
    background-size: 100px;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .map-layout {
        flex-direction: column;
        height: auto;
    }

    .sidebar {
        height: 400px;
        flex: none;
        width: 100%;
    }

    .map-wrapper {
        height: 50vh;
    }
}