/* ══════════════════════════════════════════════════════════════
   Groupe Nettoyage — Admin Dashboard
   Design inspiré de la plateforme groupenettoyage.fr
   ══════════════════════════════════════════════════════════════ */

/* ── Brand Palette ── */
:root {
    /* Brand from platform */
    --blue-dark: #0c1f33;
    --blue-primary: #1a5276;
    --blue-medium: #2980b9;
    --blue-light: #5dade2;
    --green-primary: #27ae60;
    --green-light: #58d68d;
    --teal: #1abc9c;
    --teal-hover: #16a085;

    /* Gradient signature */
    --gradient-main: linear-gradient(135deg, #1a5276 0%, #1abc9c 50%, #27ae60 100%);
    --gradient-sidebar: linear-gradient(180deg, #0c1f33 0%, #132d47 100%);
    --gradient-card-accent: linear-gradient(135deg, #1a5276, #2980b9);
    --gradient-cta: linear-gradient(135deg, #1a5276 0%, #1abc9c 100%);

    /* Dashboard surfaces */
    --bg: #f0f4f8;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #f4f7fa;
    --border: #e2e8f0;
    --border-light: #edf2f7;

    /* Text */
    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Status colors */
    --orange: #f59e0b;
    --red: #ef4444;
    --green: #22c55e;
    --yellow: #eab308;
    --blue: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);

    /* Layout */
    --sidebar-w: 270px;
    --header-h: 68px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--teal); }

/* ══════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════ */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--gradient-sidebar);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform .3s;
    box-shadow: 2px 0 20px rgba(0,0,0,0.15);
}

.sidebar-logo {
    padding: 22px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-logo img {
    height: 40px;
    width: auto;
    filter: brightness(1.1);
}

.sidebar-logo .logo-text {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.sidebar-logo .logo-text small {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 14px;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: 10px;
    color: rgba(255,255,255,0.55);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all .2s;
    margin-bottom: 2px;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.9);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(26,188,156,0.2), rgba(26,188,156,0.08));
    color: var(--teal);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--teal);
}

.sidebar-nav .nav-icon {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-badge {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.sidebar-section {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.25);
    padding: 22px 16px 8px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 18px 22px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-footer .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--blue-medium));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-footer a { color: rgba(255,255,255,0.4); }
.sidebar-footer a:hover { color: var(--red); }

/* ── Main area ── */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
    height: var(--header-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 36px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.topbar-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.content { padding: 32px 36px; max-width: 1400px; }

/* ══════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
    transition: box-shadow .2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-weight: 700;
}

/* ══════════════════════════════════════════
   STATS GRID
   ══════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: all .25s;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
    opacity: 0;
    transition: opacity .25s;
}

.stat-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card:hover::before { opacity: 1; }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.blue { background: rgba(59,130,246,.1); }
.stat-icon.green { background: rgba(34,197,94,.1); }
.stat-icon.orange { background: rgba(245,158,11,.1); }
.stat-icon.red { background: rgba(239,68,68,.1); }
.stat-icon.teal { background: rgba(26,188,156,.1); }

.stat-card:nth-child(1)::before { background: var(--teal); }
.stat-card:nth-child(2)::before { background: var(--blue); }
.stat-card:nth-child(3)::before { background: var(--green); }
.stat-card:nth-child(4)::before { background: var(--orange); }
.stat-card:nth-child(5)::before { background: var(--blue-medium); }
.stat-card:nth-child(6)::before { background: var(--green-primary); }

.stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* ── Grid layouts ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

/* ══════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }

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

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    font-weight: 700;
    background: var(--bg);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
    vertical-align: middle;
    color: var(--text-secondary);
}

tr:hover td { background: rgba(26,188,156,.03); }

/* ══════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════ */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: .3px;
}

.badge-new { background: rgba(59,130,246,.1); color: var(--blue); }
.badge-contacted { background: rgba(245,158,11,.1); color: var(--orange); }
.badge-converted { background: rgba(34,197,94,.1); color: var(--green); }
.badge-lost { background: rgba(239,68,68,.1); color: var(--red); }
.badge-admin { background: rgba(26,188,156,.1); color: var(--teal); }
.badge-partner { background: rgba(59,130,246,.1); color: var(--blue); }
.badge-success { background: rgba(34,197,94,.1); color: var(--green); }
.badge-error { background: rgba(239,68,68,.1); color: var(--red); }
.badge-active { background: rgba(34,197,94,.1); color: var(--green); }
.badge-inactive { background: rgba(239,68,68,.08); color: var(--red); }
.badge-verified { background: rgba(26,188,156,.1); color: var(--teal); }

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-cta);
    color: #fff;
    box-shadow: 0 2px 8px rgba(26,82,118,.25);
}
.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(26,82,118,.35);
    transform: translateY(-1px);
    color: #fff;
}

.btn-secondary {
    background: #fff;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--teal);
    color: var(--teal);
    background: rgba(26,188,156,.04);
}

.btn-danger { background: rgba(239,68,68,.08); color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,.15); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

.btn-generate {
    background: var(--gradient-main);
    color: #fff;
    padding: 10px 22px;
    font-size: 0.9rem;
    border-radius: 50px;
    box-shadow: 0 2px 12px rgba(26,82,118,.3);
}

.btn-generate:hover {
    box-shadow: 0 4px 18px rgba(26,82,118,.4);
    transform: translateY(-1px);
    color: #fff;
}

/* ══════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all .2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(26,188,156,.12);
    background: #fff;
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select[multiple].form-control {
    background-image: none;
    padding-right: 14px;
    min-height: 120px;
}

.checkbox-group { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--teal);
    border-radius: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════
   FLASH MESSAGES
   ══════════════════════════════════════════ */
.flash {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.flash-success {
    background: rgba(34,197,94,.08);
    border: 1px solid rgba(34,197,94,.2);
    color: var(--green-primary);
}
.flash-error {
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.2);
    color: var(--red);
}

/* ══════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════ */
.pagination {
    display: flex;
    gap: 4px;
    margin-top: 20px;
    justify-content: center;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: #fff;
    transition: all .2s;
}

.pagination a:hover { border-color: var(--teal); color: var(--teal); }
.pagination .active {
    background: var(--gradient-cta);
    color: #fff;
    border-color: transparent;
}

/* ── Search bar ── */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.search-bar .form-control { max-width: 300px; background: #fff; }

/* ══════════════════════════════════════════
   CHART
   ══════════════════════════════════════════ */
.chart-container { position: relative; height: 200px; }

.mini-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 160px;
    padding: 10px 0 25px;
}

.mini-chart .bar {
    flex: 1;
    background: var(--gradient-cta);
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: all .3s;
    position: relative;
}

.mini-chart .bar:hover { opacity: .85; transform: scaleY(1.02); transform-origin: bottom; }

.mini-chart .bar-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
}

.mini-chart .bar-value {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--blue-primary);
}

/* ══════════════════════════════════════════
   GENERATION CONSOLE
   ══════════════════════════════════════════ */
.console {
    background: #0c1f33;
    border: 1px solid rgba(26,188,156,0.15);
    border-radius: var(--radius-sm);
    padding: 18px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
    color: var(--teal);
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* ══════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-sidebar);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 80%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(26,188,156,0.08), transparent 70%);
    pointer-events: none;
}

.login-card {
    background: #fff;
    border: none;
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 8px;
}

.login-card .login-logo img {
    height: 56px;
    width: auto;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 4px;
    background: var(--gradient-cta);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.5rem;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 32px;
}

.login-card .form-control {
    background: var(--bg);
    border-color: var(--border);
}

.login-card .form-control:focus {
    background: #fff;
}

.login-card .btn-primary {
    padding: 12px;
    font-size: 0.95rem;
    border-radius: 50px;
}

/* ══════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; opacity: .6; }
.empty-state p { margin-bottom: 16px; }

/* ══════════════════════════════════════════
   STATUS DOTS
   ══════════════════════════════════════════ */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-dot.green { background: var(--green); }
.status-dot.orange { background: var(--orange); }
.status-dot.red { background: var(--red); }
.status-dot.blue { background: var(--blue); }

/* ══════════════════════════════════════════
   WELCOME BANNER (Dashboard)
   ══════════════════════════════════════════ */
.welcome-banner {
    background: var(--gradient-cta);
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    margin-bottom: 28px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.1), transparent 70%);
    pointer-events: none;
}

.welcome-banner h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.welcome-banner p {
    font-size: 0.92rem;
    opacity: .85;
    max-width: 500px;
}

.welcome-banner .banner-stats {
    display: flex;
    gap: 32px;
    margin-top: 20px;
}

.welcome-banner .banner-stat {
    text-align: center;
}

.welcome-banner .banner-stat .value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

.welcome-banner .banner-stat .label {
    font-size: 0.78rem;
    opacity: .7;
    margin-top: 4px;
}

/* ══════════════════════════════════════════
   SEO SCORE BAR
   ══════════════════════════════════════════ */
.score-bar {
    display: flex;
    border-radius: 20px;
    overflow: hidden;
    height: 8px;
    background: var(--border-light);
}

.score-bar .segment {
    transition: width .4s ease;
}

.score-bar .segment.excellent { background: var(--green); }
.score-bar .segment.good { background: var(--teal); }
.score-bar .segment.medium { background: var(--orange); }
.score-bar .segment.poor { background: var(--red); }

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .content { padding: 20px 16px; }
    .topbar { padding: 0 16px; }
    .welcome-banner { padding: 24px 20px; }
    .welcome-banner .banner-stats { gap: 20px; }
}

/* ══════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════ */
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(26,188,156,.4); }
    50% { box-shadow: 0 0 0 12px rgba(26,188,156,0); }
}

.btn-generate.loading {
    animation: pulse 1.5s infinite;
    pointer-events: none;
    opacity: .7;
}

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

.stat-card, .card {
    animation: fadeIn .4s ease both;
}

.stat-card:nth-child(2) { animation-delay: .05s; }
.stat-card:nth-child(3) { animation-delay: .1s; }
.stat-card:nth-child(4) { animation-delay: .15s; }
.stat-card:nth-child(5) { animation-delay: .2s; }
.stat-card:nth-child(6) { animation-delay: .25s; }

/* ══════════════════════════════════════════
   DEPLOY PAGE ENHANCEMENTS
   ══════════════════════════════════════════ */
.deploy-steps {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
}

.deploy-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.deploy-step.active {
    background: rgba(26,188,156,.08);
    color: var(--teal);
    border-color: rgba(26,188,156,.3);
}

.deploy-step .step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.deploy-step.active .step-num {
    background: var(--teal);
    color: #fff;
}
