/**
 * STYLES PRINCIPAUX - CaseFlow
 * Fichier: style.css
 * Rôle: Tous les styles de l'application (responsive, émoticônes UTF-8)
 */

/* ============================================
   RESET ET BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3498db;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --dark: #34495e;
    --light: #ecf0f1;
    --gray: #95a5a6;
    --text: #2c3e50;
    --border: #ddd;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: #f5f5f5;
}

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

/* ============================================
   HEADER ET NAVIGATION
   ============================================ */
header {
    background: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    /* ← SUPPRIMÉ box-shadow: var(--shadow); ← SUPPRIMÉ */
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
}

header h1 a {
    color: var(--primary);
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.search-form {
    display: flex;
}

.search-input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 250px;
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

nav {
    display: flex;
    gap: 1rem;
}

.nav-link {
    color: var(--text);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-link:hover {
    background: var(--light);
}

/* ============================================
   STATISTIQUES (DASHBOARD)
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
   /* box-shadow: var(--shadow);*/
    text-align: center;
}

.stat-card.warning {
    border-left: 4px solid var(--warning);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    color: var(--gray);
    font-size: 0.9rem;
}

/* ============================================
   AFFAIRES (CARDS)
   ============================================ */
.affaires-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.affaire-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    /*box-shadow: var(--shadow);*/
    border-left: 4px solid var(--primary);
}

.affaire-card h4 {
    margin-bottom: 10px;
}

.affaire-card h4 a {
    color: var(--text);
    text-decoration: none;
}

.affaire-card h4 a:hover {
    color: var(--primary);
}

.affaire-card p {
    color: var(--gray);
    margin-bottom: 15px;
}

.affaire-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    color: var(--gray);
    font-size: 0.9rem;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
    background: var(--light);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-bar.large {
    height: 12px;
}

.progress-fill {
    background: var(--success);
    height: 100%;
    transition: width 0.3s;
}

.progress-text {
    color: var(--gray);
    font-size: 0.9rem;
    margin-left: 10px;
}

/* ============================================
   TODO LIST
   ============================================ */
.todo-list-container {
    background: white;
    border-radius: 8px;
    /*box-shadow: var(--shadow);*/
    padding: 20px;
    margin: 20px 0;
}

.todo-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    color: var(--gray);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
}

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

.todo-items {
    list-style: none;
    margin-bottom: 20px;
}

.todo-item {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.todo-item:hover {
    background: var(--light);
}

.todo-item.completed .todo-title {
    text-decoration: line-through;
    color: var(--gray);
}

.todo-checkbox {
    margin-right: 15px;
    padding-top: 2px;
}

.todo-checkbox input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
}

.todo-checkbox input[type="checkbox"]:checked + .checkbox-custom::after {
    content: "â";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary);
    font-weight: bold;
}

.todo-content {
    flex: 1;
}

.todo-title {
    font-weight: 500;
    margin-bottom: 5px;
}

.todo-description {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.todo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--gray);
}

.due-date.overdue {
    color: var(--danger);
    font-weight: 500;
}

.todo-actions {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.todo-item:hover .todo-actions {
    opacity: 1;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    border-radius: 4px;
}

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

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 8px;
}

.badge.type-appel { background: #e1f5fe; color: #0288d1; }
.badge.type-document { background: #fff3e0; color: #f57c00; }
.badge.type-relance { background: #ffebee; color: #c62828; }
.badge.type-rdv { background: #e8f5e9; color: #2e7d32; }
.badge.urgent { background: var(--danger); color: white; }
.badge.ia { background: #9b59b6; color: white; }

/* Add task form */
.add-task-form {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.new-task-input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}

.add-task-btn {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.add-task-btn:hover {
    background: #2980b9;
}

/* Sous-tâches */
.subtasks {
    margin: 10px 0 0 20px;
    padding-left: 15px;
    border-left: 2px solid var(--light);
}

.subtask-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0;
}

.subtask-checkbox {
    width: 16px;
    height: 16px;
}

.subtask-title.completed {
    text-decoration: line-through;
    color: var(--gray);
}

/* ============================================
   REMINDERS
   ============================================ */
.reminders-list {
    background: white;
    border-radius: 8px;
   /* box-shadow: var(--shadow);*/
    padding: 20px;
}

.reminder-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border);
}

.reminder-item.overdue {
    background: #fff5f5;
}

.reminder-checkbox {
    margin-right: 15px;
}

.reminder-content {
    flex: 1;
}

.reminder-title {
    font-weight: 500;
}

.reminder-meta {
    font-size: 0.85rem;
    color: var(--gray);
}

.reminder-actions {
    display: flex;
    gap: 10px;
}

.snooze-select {
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
}

/* ============================================
   EMAILS TIMELINE
   ============================================ */
.emails-timeline {
    background: white;
    border-radius: 8px;
 /*   box-shadow: var(--shadow);*/
    padding: 20px;
}

.email-item {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.email-item.entrant {
    border-left: 3px solid var(--primary);
    margin-left: 20px;
}

.email-item.sortant {
    border-left: 3px solid var(--success);
    margin-right: 20px;
}

.email-item.pinned {
    background: #fff9c4;
}

.email-item.confidential {
    opacity: 0.8;
}

.email-header {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.email-direction {
    font-size: 1.2rem;
}

.email-date {
    color: var(--gray);
}

.email-sender {
    font-weight: 500;
}

.email-subject {
    margin-bottom: 10px;
}

.email-body {
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.5;
}

.email-body.confidential {
    font-style: italic;
    color: var(--gray);
}

.email-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.email-item:hover .email-actions {
    opacity: 1;
}

/* ============================================
   FORMULAIRES
   ============================================ */
.form {
    background: white;
    padding: 30px;
    border-radius: 8px;
  /*  box-shadow: var(--shadow);*/
    max-width: 800px;
    margin: 0 auto;
}

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

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

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--dark);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="color"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

input[type="color"] {
    height: 40px;
    padding: 5px;
}

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

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

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    background: var(--light);
    color: var(--text);
}

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

.btn-primary:hover {
    background: #2980b9;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ============================================
   TABLEAUX
   ============================================ */
.affaires-table {
    width: 100%;
    background: white;
    border-radius: 8px;
   /* box-shadow: var(--shadow);*/
    border-collapse: collapse;
    overflow: hidden;
}

.affaires-table th {
    background: var(--primary);
    color: white;
    padding: 12px;
    text-align: left;
}

.affaires-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.affaires-table tr:hover {
    background: var(--light);
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content kbd {
    background: var(--dark);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    background: linear-gradient(135deg, var(--primary), #2980b9);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 8px;
   /* box-shadow: 0 4px 20px rgba(0,0,0,0.2);*/
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 10px;
}

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

.alert {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert.error {
    background: #ffebee;
    color: var(--danger);
    border: 1px solid #ffcdd2;
}

.login-hint {
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--gray);
}

/* ============================================
   UTILS
   ============================================ */
.float-right {
    float: right;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--gray);
    font-style: italic;
}

.small {
    font-size: 0.85rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-right {
        flex-direction: column;
        width: 100%;
    }
    
    .search-form {
        width: 100%;
    }
    
    .search-input {
        width: 100%;
    }
    
    nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .todo-item {
        flex-direction: column;
    }
    
    .todo-actions {
        opacity: 1;
        margin-top: 10px;
    }
    
    .email-header {
        flex-wrap: wrap;
    }
    
    .affaires-table {
        display: block;
        overflow-x: auto;
    }
}