/**
 * =====================================================
 * REVIVA - Feuille de styles principale
 * Design moderne et responsive
 * =====================================================
 */

/* ===== Variables CSS ===== */
:root {
    --primary: #2e7d32;
    --primary-dark: #1b5e20;
    --primary-light: #4caf50;
    --secondary: #00897b;
    --accent: #ffc107;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
    --info: #2196f3;
    --dark: #212121;
    --light: #f5f5f5;
    --gray: #757575;
    --gray-light: #e0e0e0;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
    --border-radius: 12px;
    --border-radius-sm: 8px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--gray);
    margin-bottom: 2rem;
}

/* ===== Navbar ===== */
.navbar {
    padding: 0.8rem 0;
    transition: var(--transition);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
}

.navbar.scrolled {
    padding: 0.5rem 0;
    box-shadow: var(--shadow-lg);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.navbar-brand i {
    animation: rotate 4s linear infinite;
}

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

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
}

.search-form .form-control {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    width: 200px;
}

.search-form .btn {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.ecoflouz-badge {
    background: linear-gradient(135deg, var(--accent), #ffb300);
    color: var(--dark) !important;
    border-radius: 20px;
    padding: 0.4rem 1rem !important;
    font-weight: 600;
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: var(--border-radius-sm);
    padding: 0.6rem 1rem;
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--light);
}

/* ===== Hero Section ===== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    padding: 6rem 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 80%;
    height: 200%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="rgba(255,255,255,0.05)"/></svg>');
    background-size: 100px;
    animation: float 20s linear infinite;
}

@keyframes float {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-100px) rotate(360deg); }
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.8s ease;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.hero .btn {
    animation: fadeInUp 0.8s ease 0.4s both;
}

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

/* ===== Buttons ===== */
.btn {
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--primary) 100%);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-warning {
    background: linear-gradient(135deg, var(--accent) 0%, #ffb300 100%);
    color: var(--dark);
}

.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
}

.btn-lg {
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
}

/* ===== Cards ===== */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
    background: var(--white);
}

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

.card-img-top {
    height: 200px;
    object-fit: cover;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-weight: 600;
    color: var(--dark);
}

/* ===== Product Cards ===== */
.product-card {
    position: relative;
}

.product-card .badge-eco {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, var(--success), var(--primary));
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    z-index: 10;
}

.product-card .badge-condition {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
}

.product-card .price-dirham {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.product-card .price-ecoflouz {
    font-size: 0.9rem;
    color: var(--accent);
    background: rgba(255, 193, 7, 0.15);
    padding: 0.2rem 0.6rem;
    border-radius: 15px;
}

.product-card .eco-impact {
    font-size: 0.85rem;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* ===== Stats Section ===== */
.stats-section {
    background: linear-gradient(135deg, var(--dark) 0%, #424242 100%);
    color: var(--white);
    padding: 4rem 0;
}

.stat-item {
    text-align: center;
    padding: 2rem;
}

.stat-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    display: block;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.8;
}

/* ===== How It Works ===== */
.how-it-works {
    padding: 5rem 0;
    background: var(--white);
}

.step-card {
    text-align: center;
    padding: 2rem;
    position: relative;
}

.step-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 1.5rem;
    position: relative;
    z-index: 1;
}

.step-card:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 45px;
    right: -50%;
    width: 100%;
    height: 3px;
    background: var(--gray-light);
    z-index: 0;
}

.step-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

/* ===== Services Section ===== */
.services-section {
    padding: 5rem 0;
    background: var(--light);
}

.service-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    height: 100%;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.service-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: var(--white);
}

/* ===== Dashboard ===== */
.dashboard-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
}

.stat-card-icon.primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.stat-card-icon.warning { background: linear-gradient(135deg, var(--accent), #ffb300); }
.stat-card-icon.success { background: linear-gradient(135deg, var(--success), var(--primary)); }
.stat-card-icon.info { background: linear-gradient(135deg, var(--info), #1976d2); }

.stat-card-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark);
}

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

/* ===== Forms ===== */
.form-control,
.form-select {
    padding: 0.8rem 1rem;
    border-radius: var(--border-radius-sm);
    border: 2px solid var(--gray-light);
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.form-label {
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.input-group-text {
    background: var(--light);
    border: 2px solid var(--gray-light);
    border-right: none;
}

/* ===== Auth Pages ===== */
.auth-container {
    min-height: calc(100vh - 76px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--light) 0%, var(--gray-light) 100%);
}

.auth-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    width: 100%;
    max-width: 450px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo i {
    font-size: 4rem;
    color: var(--primary);
}

/* ===== Tables ===== */
.table-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--light);
    border: none;
    padding: 1rem;
    font-weight: 600;
    color: var(--dark);
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-color: var(--gray-light);
}

.table tbody tr:hover {
    background: var(--light);
}

/* ===== Status Badges ===== */
.status-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.pending { background: #fff3e0; color: #e65100; }
.status-badge.en_attente { background: #fff3e0; color: #e65100; }
.status-badge.en_route { background: #e3f2fd; color: #1565c0; }
.status-badge.recupere { background: #e8f5e9; color: #2e7d32; }
.status-badge.verifie { background: #f3e5f5; color: #7b1fa2; }
.status-badge.valorise { background: #e8f5e9; color: #1b5e20; }
.status-badge.completed { background: #e8f5e9; color: #1b5e20; }
.status-badge.cancelled, .status-badge.annule { background: #ffebee; color: #c62828; }

/* ===== Back to Top ===== */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    display: none;
    z-index: 999;
    transition: var(--transition);
}

#backToTop:hover {
    transform: translateY(-5px);
}

#backToTop.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Animations ===== */
.fade-in {
    animation: fadeIn 0.5s ease;
}

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

.slide-up {
    animation: slideUp 0.5s ease;
}

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

/* ===== File Upload ===== */
.file-upload-area {
    border: 2px dashed var(--gray-light);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--primary);
    background: rgba(46, 125, 50, 0.05);
}

.file-upload-area i {
    font-size: 3rem;
    color: var(--gray);
    margin-bottom: 1rem;
}

/* ===== Collection Tracker ===== */
.collection-tracker {
    display: flex;
    justify-content: space-between;
    margin: 2rem 0;
    position: relative;
}

.collection-tracker::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gray-light);
    z-index: 0;
}

.tracker-step {
    text-align: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.tracker-step .step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-light);
    color: var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    font-weight: 600;
    transition: var(--transition);
}

.tracker-step.active .step-circle,
.tracker-step.completed .step-circle {
    background: var(--primary);
    color: var(--white);
}

.tracker-step .step-label {
    font-size: 0.8rem;
    color: var(--gray);
}

.tracker-step.active .step-label,
.tracker-step.completed .step-label {
    color: var(--primary);
    font-weight: 500;
}

/* ===== Admin Dashboard ===== */
.admin-sidebar {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    position: sticky;
    top: 100px;
}

.admin-nav .nav-link {
    color: var(--dark);
    padding: 0.8rem 1rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 0.3rem;
}

.admin-nav .nav-link:hover,
.admin-nav .nav-link.active {
    background: var(--primary);
    color: var(--white);
}

.admin-nav .nav-link i {
    width: 25px;
}

/* ===== Filters ===== */
.filter-section {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--light);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    margin: 0.25rem;
}

.filter-tag .btn-close {
    font-size: 0.6rem;
}

/* ===== EcoFlouz Display ===== */
.ecoflouz-display {
    background: linear-gradient(135deg, var(--accent), #ffb300);
    border-radius: var(--border-radius);
    padding: 2rem;
    color: var(--dark);
    text-align: center;
}

.ecoflouz-amount {
    font-size: 3rem;
    font-weight: 700;
}

.ecoflouz-label {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* ===== Impact Display ===== */
.impact-card {
    background: linear-gradient(135deg, var(--success), var(--secondary));
    border-radius: var(--border-radius);
    padding: 1.5rem;
    color: var(--white);
    text-align: center;
}

.impact-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.impact-value {
    font-size: 2rem;
    font-weight: 700;
}

.impact-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s ease-in-out infinite;
}

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

/* ===== Media Queries ===== */
@media (max-width: 991.98px) {
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .search-form {
        display: none !important;
    }
    
    .step-card:not(:last-child)::after {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .hero {
        padding: 4rem 0;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-item {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .auth-card {
        padding: 2rem;
    }
    
    .collection-tracker {
        flex-direction: column;
        gap: 1rem;
    }
    
    .collection-tracker::before {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .btn-lg {
        padding: 0.6rem 1.5rem;
        font-size: 1rem;
    }
    
    .ecoflouz-badge {
        font-size: 0.85rem;
        padding: 0.3rem 0.8rem !important;
    }
}

/* ===== Print Styles ===== */
@media print {
    .navbar,
    .footer,
    #backToTop,
    .btn {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Cacher la barre de recherche du header */
.search-form,
.search-box,
form[role="search"],
.header-search {
    display: none !important;
}

/* FIX Header - Liens blancs visibles */
.navbar .nav-link {
    color: white !important;
    font-weight: 500;
}

.navbar .nav-link:hover {
    color: #ffc107 !important;
}