/* =============================================
   CRM - Design Soft & Moderne
   ============================================= */

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #f1f5f9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --dark: #1e293b;
    --gray: #64748b;
    --light-gray: #e2e8f0;
    --white: #ffffff;
    --bg: #f8fafc;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 15px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =============================================
   LOGIN PAGE
   ============================================= */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: var(--white);
    padding: 50px 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 10px;
    color: var(--dark);
    font-size: 28px;
    font-weight: 700;
}

.login-box p {
    text-align: center;
    color: var(--gray);
    margin-bottom: 30px;
}

/* =============================================
   LAYOUT
   ============================================= */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--white);
    border-right: 1px solid var(--light-gray);
    padding: 25px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 25px 25px;
    border-bottom: 1px solid var(--light-gray);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 22px;
    color: var(--primary);
    font-weight: 700;
}

.sidebar-header span {
    font-size: 12px;
    color: var(--gray);
}

.sidebar-nav {
    padding: 0 15px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    color: var(--gray);
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 5px;
}

.nav-item:hover {
    background: var(--secondary);
    color: var(--dark);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 25px;
    border-top: 1px solid var(--light-gray);
    background: var(--white);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
}

.user-details h4 {
    font-size: 14px;
    font-weight: 600;
}

.user-details span {
    font-size: 12px;
    color: var(--gray);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--dark);
}

/* =============================================
   CARDS & STATS
   ============================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.stat-card .stat-icon.blue { background: #dbeafe; color: var(--info); }
.stat-card .stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-card .stat-icon.orange { background: #fef3c7; color: var(--warning); }
.stat-card .stat-icon.purple { background: #e9d5ff; color: #9333ea; }

.stat-card h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-card p {
    color: var(--gray);
    font-size: 14px;
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 25px;
}

/* =============================================
   FORMS
   ============================================= */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--light-gray);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: all 0.2s;
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* =============================================
   BUTTONS
   ============================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

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

.btn-secondary {
    background: var(--secondary);
    color: var(--dark);
}

.btn-secondary:hover {
    background: var(--light-gray);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* =============================================
   TABLE
   ============================================= */

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--light-gray);
}

table th {
    background: var(--secondary);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray);
}

table tr:hover {
    background: var(--secondary);
}

table td {
    font-size: 14px;
}

/* =============================================
   BADGES / LABELS
   ============================================= */

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-nouveau { background: #dbeafe; color: #1d4ed8; }
.badge-ne_repond_pas { background: #fef3c7; color: #b45309; }
.badge-a_rappeler { background: #e9d5ff; color: #7c3aed; }
.badge-pas_interesse { background: #fee2e2; color: #dc2626; }
.badge-bon { background: #d1fae5; color: #059669; }

.badge-admin { background: var(--primary); color: var(--white); }
.badge-user { background: var(--secondary); color: var(--dark); }

/* =============================================
   MODAL
   ============================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--light-gray);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =============================================
   TIMELINE / HISTORIQUE
   ============================================= */

.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--light-gray);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--white);
}

.timeline-item .time {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 5px;
}

.timeline-item .content {
    background: var(--secondary);
    padding: 12px 15px;
    border-radius: var(--radius-sm);
}

/* =============================================
   AGENDA
   ============================================= */

.agenda-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid var(--light-gray);
    transition: background 0.2s;
}

.agenda-item:hover {
    background: var(--secondary);
}

.agenda-date {
    min-width: 60px;
    text-align: center;
}

.agenda-date .day {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.agenda-date .month {
    font-size: 12px;
    color: var(--gray);
    text-transform: uppercase;
}

.agenda-info h4 {
    font-weight: 600;
    margin-bottom: 5px;
}

.agenda-info p {
    font-size: 13px;
    color: var(--gray);
}

/* =============================================
   ALERTS
   ============================================= */

.alert {
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

/* =============================================
   SEARCH & FILTERS
   ============================================= */

.search-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.search-bar .form-control {
    flex: 1;
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--light-gray);
    background: var(--white);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* =============================================
   UTILITIES
   ============================================= */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mt-2 { margin-top: 20px; }
.d-flex { display: flex; }
.gap-1 { gap: 10px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 15px 0;
    }
    
    .sidebar-header h2,
    .sidebar-header span,
    .nav-item span,
    .user-details {
        display: none;
    }
    
    .sidebar-header {
        padding: 0 15px 15px;
    }
    
    .nav-item {
        justify-content: center;
        padding: 15px;
    }
    
    .main-content {
        margin-left: 80px;
    }
    
    .user-info {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}
