/* CRM Développement - Thème Mobile First (theme-09) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #f472b6;
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --container-width: 1200px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-xl: 32px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-main: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

h1, h2, h3, h4 { letter-spacing: -0.025em; font-weight: 800; }
a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; }
.hidden { display: none !important; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    gap: 0.5rem;
    font-size: 0.9rem;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary, .btn-outline {
    background-color: white;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover, .btn-outline:hover {
    background-color: #f8fafc;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }

/* ================= DASHBOARD LAYOUT ================= */
.dash-layout {
    display: flex;
    min-height: 100vh;
    background-color: #f1f5f9;
}

.dash-sidebar {
    width: 260px;
    background: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e2e8f0;
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: 8px;
    margin: 0 0.75rem 0.25rem;
    transition: all 0.2s;
}

.sidebar-nav .nav-link:hover { background: #f8fafc; color: var(--text-main); }
.sidebar-nav .nav-link.active { background: #e0e7ff; color: var(--primary); }

.dash-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dash-header {
    height: 70px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.dash-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* Widgets */
.grid-cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-cols-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }

.dash-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h3 { margin: 0; font-size: 1.1rem; }

/* Table */
.app-table {
    width: 100%;
    border-collapse: collapse;
}

.app-table th {
    text-align: left;
    padding: 1rem;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.app-table td {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.app-table tr:hover td { background: #f8fafc; }

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.green { background: #dcfce7; color: #166534; }
.status-badge.red { background: #fee2e2; color: #991b1b; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: 0.6rem 0.9rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 1rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.alert-success { background: #dcfce7; border: 1px solid #22c55e; color: #166534; }
.alert-error { background: #fee2e2; border: 1px solid #ef4444; color: #991b1b; }

/* Page header */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-title { font-size: 1.5rem; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
}
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.9rem; color: var(--text-muted); }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 2rem; color: var(--text-muted); }
.empty-state p { margin-bottom: 1rem; }

/* Checkboxes */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 1rem; }
.checkbox-item { display: flex; align-items: center; gap: 0.5rem; }
.permissions-section { margin-bottom: 1.5rem; }
.permissions-section h4 { margin-bottom: 0.75rem; color: var(--text-muted); font-size: 0.9rem; }

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: radial-gradient(circle at 50% 0%, #e0e7ff 0%, var(--bg-page) 60%);
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.login-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 1.5rem; text-align: center; color: var(--text-main); }
.login-page .form-group { margin-bottom: 1.25rem; }
.login-page .btn { width: 100%; justify-content: center; padding: 0.75rem; }

/* Mobile */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}

@media (max-width: 1024px) {
    .dash-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .dash-sidebar.open { transform: translateX(0); }
    .mobile-menu-toggle { display: block; }
    .grid-cols-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .grid-cols-2 { grid-template-columns: 1fr; }
    .dash-content { padding: 1rem; }
}
