/* ==========================
   CRM.CSS - VERSION COMPACTE (FIT SCREEN)
   ========================== */

/* 1. NAVIGATION (Boutons Onglets) */
.nav-switch {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #ccc;
    font-weight: bold;
    cursor: pointer;
    padding: 0 15px;
    height: 80px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}
.nav-switch:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-switch.active { color: white; border-bottom: 3px solid #1b1b1b; background: rgba(0,0,0,0.2); }

/* 2. CONTENEUR PRINCIPAL */
#app-crm {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Pas de scroll de page global */
}

/* 3. BARRE D'OUTILS */
.crm-toolbar {
    height: 50px;
    min-height: 50px;
    background: white;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.crm-btn-primary { background: #009c6b; color: white; border: none; padding: 8px 16px; border-radius: 4px; font-weight: bold; cursor: pointer; font-size: 13px; }
.crm-btn-secondary { background: white; color: #333; border: 1px solid #ccc; padding: 8px 16px; border-radius: 4px; font-weight: bold; cursor: pointer; font-size: 13px; margin-right: 10px; }

/* 4. LE TABLEAU (Zone flexible) */
.kanban-container {
    flex: 1; /* Prend toute la hauteur */
    display: flex;
    flex-direction: row;
    
    padding: 15px; /* Un peu moins de padding pour gagner de la place */
    gap: 10px;     /* Espace réduit entre les colonnes */
    
    overflow-x: auto; /* Scroll horizontal SEULEMENT si vraiment nécessaire (petit écran) */
    overflow-y: hidden; 
    align-items: stretch; /* Hauteur 100% pour tout le monde */
}

/* 5. LA COLONNE (Élastique) */
.kanban-column {
    /* LE CHANGEMENT EST ICI : */
    flex: 1;            /* "1" signifie : prenez toutes la même largeur */
    min-width: 200px;   /* Largeur minimale pour ne pas être écrasé (sécurité) */
    /* On enlève le width: 300px fixe */
    
    background: #ebecf0;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.column-header {
    padding: 10px; /* Padding réduit */
    font-weight: bold;
    color: #172b4d;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    font-size: 13px; /* Police un peu plus petite */
}

/* 6. CORPS DE LA COLONNE (Scroll vertical) */
.column-body {
    padding: 6px;
    flex: 1;
    overflow-y: auto; 
    min-height: 0;
}

/* Style Scrollbar */
.column-body::-webkit-scrollbar { width: 6px; }
.column-body::-webkit-scrollbar-thumb { background-color: #ccc; border-radius: 3px; }

/* CARTES */
.deal-card {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 8px;
    padding: 8px; /* Padding réduit */
    border-left: 4px solid #1b1b1b;
    cursor: grab;
    transition: transform 0.1s;
}
.deal-card:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.deal-card.dragging { opacity: 0.5; transform: rotate(2deg); border: 2px dashed #1b1b1b; }

.deal-title { font-weight: bold; color: #333; margin-bottom: 4px; font-size: 13px; word-wrap: break-word; }
.deal-client { font-size: 11px; color: #666; margin-bottom: 4px; }
.deal-price { font-weight: bold; color: #2ecc71; font-size: 12px; }
.deal-footer { margin-top: 6px; padding-top: 6px; border-top: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }

.btn-launch-takeoff { background: #f0f0f0; border: 1px solid #ccc; font-size: 9px; padding: 3px 6px; border-radius: 3px; cursor: pointer; font-weight: bold; }
.btn-launch-takeoff:hover { background: #1b1b1b; color: white; border-color: #1b1b1b; }

/* CLIENT LIST */
.client-list-item:hover { background: #f5f5f5 !important; border-left: 3px solid #1b1b1b; padding-left: 5px !important; }

/* --- CRM HEADER AMÉLIORÉ --- */
.crm-header-bar {
    background: white;
    border-bottom: 1px solid #ddd;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
    flex-shrink: 0;
}

.crm-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.crm-select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-weight: bold;
    color: #1b1b1b;
    cursor: pointer;
}

.btn-crm-settings {
    background: #f1f1f1;
    border: 1px solid #ccc;
    color: #555;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.btn-crm-settings:hover { background: #e2e6ea; }

.btn-new-deal {
    background: #009c6b; /* Vert style Pipedrive */
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.btn-new-deal:hover { background: #007f56; }

/* Ajustement stage row */
.stage-edit-row {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

/* --- DASHBOARD DEAL --- */
.dashboard-header {
    background: #f8f9fa;
    padding: 20px 30px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-launch-takeoff.big {
    background: #1b1b1b;
    color: white;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,123,255,0.2);
    transition: transform 0.2s;
}
.btn-launch-takeoff.big:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.dashboard-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: white;
}

/* Colonne Gauche (Activités) */
.dash-col-main {
    flex: 2;
    padding: 30px;
    border-right: 1px solid #eee;
    overflow-y: auto;
    background: white;
}

/* Zone de saisie */
.activity-input-box {
    background: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
}
.activity-input-box textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    min-height: 60px;
    font-family: inherit;
    resize: vertical;
}
.tab-btn {
    background: none;
    border: none;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    padding-bottom: 5px;
}
.tab-btn.active {
    color: #333;
    border-bottom: 2px solid #333;
}

/* Feed */
.activity-feed {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.activity-item {
    display: flex;
    gap: 15px;
}
.act-icon {
    width: 30px; height: 30px;
    background: #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.act-content {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 6px;
    flex: 1;
    font-size: 13px;
    color: #333;
}
.act-date { font-size: 10px; color: #999; margin-bottom: 3px; }

/* Colonne Droite (Sidebar) */
.dash-col-sidebar {
    flex: 1;
    padding: 20px;
    background: #fafafa;
    overflow-y: auto;
    max-width: 350px;
}
.sidebar-block {
    margin-bottom: 25px;
    background: white;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 6px;
}
.sidebar-block h4 { margin-top: 0; margin-bottom: 10px; color: #333; border-bottom: 1px solid #eee; padding-bottom: 5px; }
.info-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; border-bottom: 1px dashed #eee; padding-bottom: 4px; }

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}
.file-item:hover { background: #e3f2fd; border-color: #1b1b1b; }

/* Bouton Retour dans la vue détail */
.btn-back-crm {
    background: white;
    border: 1px solid #ccc;
    color: #555;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}
.btn-back-crm:hover {
    background: #f0f0f0;
    color: #333;
    border-color: #bbb;
}
