/* Fichier: css/pro-style.css
   Rôle: Feuille de style unique pour tout l'Espace Pro avec fond animé
*/

:root {
    /* Palette de Couleurs "Outfit" */
    --primary: #4f46e5;       /* Indigo principal */
    --primary-hover: #4338ca;
    --secondary: #64748b;     /* Gris bleuté */
    --accent: #06b6d4;        /* Cyan pour les actions */
    
    --success: #10b981;       /* Vert */
    --warning: #f59e0b;       /* Orange */
    --danger: #ef4444;        /* Rouge */
    
    --dark: #1e293b;          /* Texte principal */
    --gray: #64748b;          /* Texte secondaire */
    --light: #f1f5f9;         /* Fond de page (fallback) */
    --white: #ffffff;         /* Fond des cartes */
    
    --border: #e2e8f0;
    
    /* Dimensions & Effets */
    --radius: 16px;
    --radius-sm: 8px;
    --shadow: 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);
    
    /* Couleurs Statuts (Spécifiques CRM) */
    --st-non-fait: #94a3b8; 
    --st-visite: #a855f7; 
    --st-devis: #3b82f6;
    --st-attente: #f59e0b; 
    --st-acompte: #ea580c; 
    --st-valide: #fbbf24; 
    --st-cours: #0ea5e9;
    --st-fait: #22c55e; 
    --st-termine: #15803d;
}

/* --- Base & Animation Fond --- */
body {
    font-family: 'Outfit', sans-serif;
    color: var(--dark);
    margin: 0;
    padding-bottom: 90px; /* Espace pour le menu mobile fixe */
    line-height: 1.5;

    /* ANIMATION FOND DÉGRADÉ (Couleurs plus soutenues) */
    /* Indigo moyen, Bleu moyen, Rose moyen, Orange moyen */
    background: linear-gradient(-45deg, #a5b4fc, #93c5fd, #f9a8d4, #fdba74);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; padding: 0; margin: 0; }
* { box-sizing: border-box; }

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* --- Cartes (Cards) --- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

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

.card h2, .card h3 {
    margin: 0;
    color: var(--dark);
    font-weight: 700;
}

/* --- Header Pro (Nouveau Design) --- */
.header-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 15px 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    padding: 2px;
    background: white;
}

.header-details h1 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--dark);
    font-weight: 800;
}

.header-details small {
    display: block;
    color: var(--gray);
    font-size: 0.85rem;
    font-weight: 500;
}

.header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    text-align: right;
}

.live-clock {
    font-family: monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    background: #e0e7ff;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.sub-info {
    font-size: 0.8rem;
    color: var(--gray);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* --- KPIs (Indicateurs) --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.kpi-card {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: -10px; right: -10px;
    width: 60px; height: 60px;
    border-radius: 50%;
    opacity: 0.1;
}

.kpi-money .kpi-value { color: var(--success); }
.kpi-money::after { background: var(--success); }

.kpi-jobs .kpi-value { color: var(--primary); }
.kpi-jobs::after { background: var(--primary); }

.kpi-alert .kpi-value { color: var(--danger); }
.kpi-alert::after { background: var(--danger); }

.kpi-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.2;
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--gray);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
}

/* --- Grille Dashboard --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* --- Liste Tâches --- */
.task-list {
    max-height: 400px;
    overflow-y: auto;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--light);
    transition: background 0.2s;
}
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: #f8fafc; }

.task-left { display: flex; flex-direction: column; gap: 2px; }
.task-client { font-weight: 700; color: var(--dark); font-size: 0.95rem; }
.task-desc { 
    font-size: 0.85rem; color: var(--gray); 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
    max-width: 200px; 
}
.task-meta { font-size: 0.75rem; color: var(--gray); display: flex; gap: 10px; align-items: center; }

/* --- Tableaux --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    background: #f8fafc;
    color: var(--gray);
    font-weight: 600;
    text-align: left;
    padding: 12px 15px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    color: var(--dark);
    vertical-align: middle;
}

tr:hover td { background-color: #f8fafc; }

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

.btn:hover { transform: translateY(-2px); filter: brightness(110%); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--border); color: var(--dark); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* Boutons icônes ronds */
.btn-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    background: #e0e7ff;
    transition: 0.2s;
}
.btn-icon:hover { background: var(--primary); color: white; }

/* --- Badges & Statuts --- */
.badge {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }
.badge-urgent { background: var(--danger); color: white; animation: pulse 2s infinite; }

/* Couleurs Statuts CRM */
.st-non-fait { background: var(--st-non-fait); color: white; }
.st-en-cours { background: var(--st-cours); color: white; }
.st-termine { background: var(--st-termine); color: white; }

/* --- Navigation Mobile Fixe --- */
.nav-mobile {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 10px 0 25px 0; /* Extra padding safe-area iOS */
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--gray);
    font-size: 0.7rem;
    font-weight: 500;
    flex: 1;
    padding: 5px;
    border: none;
    background: none;
    cursor: pointer;
}

.nav-item i {
    font-size: 1.4rem;
    margin-bottom: 4px;
    transition: transform 0.2s;
}

.nav-item.active { color: var(--primary); font-weight: 700; }
.nav-item.active i { transform: translateY(-3px); }
.btn-refresh { color: var(--success); }

/* --- Formulaires --- */
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; color: var(--dark); }
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* --- Modale (Bulle) --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active, .modal-overlay.visible {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-box, .modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-iframe {
    width: 100%;
    height: 500px;
    border: none;
}

.modal-close-btn {
    position: absolute;
    top: 15px; right: 15px;
    background: var(--light);
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    color: var(--dark);
    z-index: 10;
    display: flex; align-items: center; justify-content: center;
}

/* --- Carte Parrainage --- */
.referral-card {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-radius: var(--radius);
    padding: 25px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}
.referral-card h3 { color: white !important; margin-bottom: 10px; }
.referral-code {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: rgba(255,255,255,0.2);
    padding: 10px;
    border-radius: 8px;
    margin: 15px 0;
    font-family: monospace;
}
.btn-referral {
    background: white; color: var(--primary);
    padding: 12px 25px; border-radius: 50px;
    font-weight: 700; text-decoration: none;
    display: inline-block; box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

/* Responsive */
@media (max-width: 768px) {
    .header-card { flex-direction: column; text-align: center; gap: 10px; }
    .header-profile { flex-direction: column; }
    .header-actions { align-items: center; width: 100%; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
}