/**
 * Shiftline - Styles personnalisés
 * Design moderne clair avec accents violet/indigo
 */

/* Variables CSS */
:root {
    --primary-color: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #818cf8;
    --secondary-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --out-color: #f97316;
    --dark-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #06b6d4 100%);
    --gradient-dark: linear-gradient(180deg, #f1f5f9 0%, #ffffff 100%);
    --shadow-glow: 0 0 40px rgba(79, 70, 229, 0.15);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

/* Reset et base */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gradient-dark);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Space Grotesk', 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
}

/* Liens */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Boutons */
.btn {
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
    background: var(--gradient-primary);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
    color: white;
}

.btn-outline-light {
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    background: transparent;
}

.btn-outline-light:hover {
    background: #f1f5f9;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

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

.btn-outline-danger {
    border: 2px solid var(--danger-color);
    color: var(--danger-color);
    background: transparent;
}

.btn-outline-danger:hover {
    background: var(--danger-color);
    color: white;
}

/* Formulaires */
.form-control, .form-select {
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 0.875rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    background: #ffffff;
    border-color: var(--primary-color);
    color: var(--text-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-check-input {
    background-color: #ffffff;
    border-color: var(--border-color);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Tables */
.table {
    color: var(--text-primary);
    --bs-table-bg: transparent;
}

.table thead th {
    background: #f8fafc;
    border-color: var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem;
}

.table tbody td {
    border-color: var(--border-color);
    padding: 1rem;
    vertical-align: middle;
}

.table tbody tr {
    transition: background 0.2s ease;
}

.table tbody tr:hover {
    background: rgba(79, 70, 229, 0.05);
}

/* Navbar */
.navbar {
    background: #ffffff !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.navbar-brand {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color) !important;
    background: rgba(79, 70, 229, 0.1);
}

.navbar-toggler {
    border-color: var(--border-color);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(100, 116, 139, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.dropdown-menu {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

.dropdown-item {
    color: var(--text-primary);
    padding: 0.5rem 1rem;
}

.dropdown-item:hover {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

/* Page de login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.login-card {
    max-width: 420px;
    width: 100%;
    padding: 2.5rem;
    background: #ffffff;
}

.login-logo {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.code-input {
    font-size: 2rem;
    letter-spacing: 1rem;
    text-align: center;
    font-family: 'Space Grotesk', monospace;
}

/* Badges/Pills */
.badge {
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 500;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.badge-planifie {
    background: rgba(79, 70, 229, 0.15);
    color: var(--primary-color);
}

.badge-planifie::before {
    background: var(--primary-color);
}

.badge-effectue {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
}

.badge-effectue::before {
    background: var(--success-color);
}

.badge-out {
    background: rgba(249, 115, 22, 0.15);
    color: var(--out-color);
}

.badge-out::before {
    background: var(--out-color);
}

.badge-en_attente {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
}

.badge-en_attente::before {
    background: var(--warning-color);
}

.badge-en_cours {
    background: rgba(6, 182, 212, 0.15);
    color: var(--secondary-color);
}

.badge-en_cours::before {
    background: var(--secondary-color);
}

.badge-annule {
    background: #dc3545;
    color: white;
}

.badge-annule::before {
    background: white;
}

/* Map container */
.map-container {
    height: 500px;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

@media (max-width: 768px) {
    .map-container {
        height: 350px;
    }
}

/* Planning liste */
.planning-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    cursor: grab;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.planning-item:active {
    cursor: grabbing;
}

.planning-item.dragging {
    opacity: 0.5;
    transform: scale(1.02);
}

.planning-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

.planning-item .drag-handle {
    color: var(--text-secondary);
    margin-right: 1rem;
}

/* Swipe actions */
.swipe-container {
    position: relative;
    overflow: hidden;
}

.swipe-actions {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    display: flex;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.swipe-container.swiped .swipe-actions {
    transform: translateX(0);
}

.swipe-btn {
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    border: none;
}

.swipe-btn-done {
    background: var(--success-color);
}

.swipe-btn-out {
    background: var(--out-color);
}

/* Calendrier */
.calendar-day {
    padding: 0.75rem;
    text-align: center;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    color: var(--text-primary);
}

.calendar-day:hover {
    background: rgba(79, 70, 229, 0.1);
}

.calendar-day.selected {
    background: var(--primary-color);
    color: white;
}

.calendar-day.today {
    border-color: var(--secondary-color);
}

.calendar-day.unavailable {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    cursor: not-allowed;
}

/* Time slots */
.time-slot {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-slot:hover:not(.unavailable) {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.time-slot.selected {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
}

.time-slot.unavailable {
    background: rgba(239, 68, 68, 0.05);
    border-color: var(--danger-color);
    color: var(--text-secondary);
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Disponibilités client */
.dispo-day {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

.dispo-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.dispo-day.disabled {
    opacity: 0.5;
    background: rgba(239, 68, 68, 0.05);
}

/* Modales */
.modal-content {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.btn-close {
    filter: none;
}

/* Alertes */
.alert {
    border: none;
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.alert-info {
    background: rgba(6, 182, 212, 0.15);
    color: #0e7490;
}

/* Loader */
.loader {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease;
}

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

/* Stats cards */
.stat-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: var(--shadow-card);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* WhatsApp button */
.btn-whatsapp {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
}

.btn-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .login-card {
        padding: 1.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
}

/* Leaflet customizations */
.leaflet-popup-content-wrapper {
    background: #ffffff;
    border-radius: 12px;
    color: var(--text-primary);
    box-shadow: var(--shadow-card);
}

.leaflet-popup-tip {
    background: #ffffff;
}

.leaflet-popup-content {
    margin: 1rem;
}

/* Client marker icons */
.marker-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
}

.marker-green {
    background: var(--success-color);
    color: white;
}

.marker-red {
    background: var(--danger-color);
    color: white;
}

.marker-orange {
    background: var(--out-color);
    color: white;
}

/* Sortable ghost */
.sortable-ghost {
    opacity: 0.4;
}

.sortable-chosen {
    background: rgba(79, 70, 229, 0.1);
}

/* List group items */
.list-group-item {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Input group */
.input-group-text {
    background: #f8fafc;
    border: 2px solid var(--border-color);
    border-right: none;
    color: var(--text-secondary);
}

.input-group .form-control {
    border-left: none;
}

.input-group .form-control:focus {
    border-color: var(--border-color);
}

.input-group:focus-within .input-group-text {
    border-color: var(--primary-color);
}

.input-group:focus-within .form-control {
    border-color: var(--primary-color);
}

/* Text utilities */
.text-secondary {
    color: var(--text-secondary) !important;
}

.text-light {
    color: var(--text-primary) !important;
}

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

/* Intervenant mobile styles */
.intervention-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 1rem;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-card);
}

.intervention-content {
    padding: 1.25rem;
    position: relative;
    z-index: 2;
    background: var(--card-bg);
    transition: transform 0.3s ease;
}

.intervention-actions {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    display: flex;
    z-index: 1;
}

.action-btn {
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.action-btn i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.action-done {
    background: var(--success-color);
}

.action-out {
    background: var(--out-color);
}

.intervention-card.swiped .intervention-content {
    transform: translateX(-160px);
}

.intervention-card.out {
    border-color: var(--out-color);
    opacity: 0.7;
}

.intervention-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
    color: white;
}

.call-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-picker {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
}

/* Client info box */
.client-info {
    background: rgba(79, 70, 229, 0.08);
    border-radius: 12px;
    padding: 1rem;
}
