/* ===================================
   Application Saisie Électorale - CAGV
   Design Moderne & Responsive
   =================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #22c55e;
    --success-dark: #16a34a;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --info: #06b6d4;
    --light: #f8fafc;
    --dark: #1e293b;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
}

/* Container principal */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

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

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

.app-header .logo img {
    height: 50px;
    width: auto;
}

.app-header .logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.app-header .logo h1 span {
    color: var(--primary);
}

.app-header .user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-header .bureau-badge {
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 25px;
}

.card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px 25px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header.success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
}

.card-header.danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
}

.card-header.admin {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.card-body {
    padding: 25px;
}

/* Login Page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.login-header img {
    height: 70px;
    margin-bottom: 15px;
}

.login-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.login-header p {
    opacity: 0.9;
    font-size: 0.95rem;
}

.login-body {
    padding: 35px 30px;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--gray-100);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-control.input-lg {
    padding: 18px 20px;
    font-size: 1.1rem;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 20px;
    padding-right: 45px;
}

/* Number inputs pour votes */
.vote-input {
    width: 120px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    padding: 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.vote-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
    outline: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.35);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.35);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--dark);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 18px 35px;
    font-size: 1.1rem;
}

/* Tables */
.table-candidates {
    width: 100%;
    border-collapse: collapse;
}

.table-candidates th,
.table-candidates td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table-candidates th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table-candidates tr:hover {
    background: var(--gray-100);
}

.table-candidates .candidate-name {
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-candidates .candidate-number {
    width: 30px;
    height: 30px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

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

.stat-box {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-box .stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
}

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

.stat-box.success .stat-value {
    color: var(--success);
}

.stat-box.danger .stat-value {
    color: var(--danger);
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #7dd3fc;
}

/* Admin Panel */
.admin-sidebar {
    background: var(--dark);
    color: white;
    width: 260px;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 25px 0;
}

.admin-sidebar .logo {
    padding: 0 25px 25px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.admin-sidebar .logo h2 {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-sidebar .nav-item {
    display: block;
    padding: 14px 25px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-sidebar .nav-item:hover,
.admin-sidebar .nav-item.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.admin-content {
    margin-left: 260px;
    padding: 30px;
    min-height: 100vh;
    background: var(--gray-100);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: all 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--gray-100);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--gray-200);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Centaine selector */
.centaine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.centaine-btn {
    padding: 15px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    text-align: center;
}

.centaine-btn:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

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

/* Total display */
.total-display {
    background: linear-gradient(135deg, var(--dark) 0%, #374151 100%);
    color: white;
    padding: 25px;
    border-radius: var(--radius);
    text-align: center;
    margin-top: 20px;
}

.total-display .total-value {
    font-size: 3rem;
    font-weight: 700;
}

.total-display .total-label {
    opacity: 0.8;
    margin-top: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .admin-sidebar {
        width: 100%;
        position: relative;
        min-height: auto;
    }
    
    .admin-content {
        margin-left: 0;
    }
    
    .table-candidates {
        display: block;
        overflow-x: auto;
    }
    
    .vote-input {
        width: 80px;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
    }
    
    .no-print {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* Icon placeholder (utiliser avec FontAwesome ou similaire) */
.icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
