/* Mobile-first styles for Actyma Mobile */
:root {
    --primary-color: #0d6efd;
    --touch-target-min: 44px;
}

/* Prevent text selection on buttons */
.btn {
    -webkit-user-select: none;
    user-select: none;
}

/* Touch-friendly elements */
.btn, .form-control, .form-select {
    min-height: var(--touch-target-min);
    font-size: 16px; /* Prevents iOS zoom on focus */
}

.form-check-input {
    width: 1.5em;
    height: 1.5em;
}

.form-check-label {
    padding-left: 0.5em;
    font-size: 1.1rem;
}

/* Card improvements for mobile */
.card {
    margin-bottom: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.card-body {
    padding: 1.25rem;
}

/* Large touch buttons */
.btn-touch {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 10px;
}

/* Photo upload styling */
.photo-upload-btn {
    width: 100%;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

/* Status badges */
.badge {
    padding: 0.5em 1em;
    font-size: 0.9rem;
}

/* Accordion for mobile */
.accordion-button {
    padding: 1rem;
    font-size: 1.1rem;
}

/* Input groups */
.input-group-text {
    min-width: 50px;
    justify-content: center;
}

/* Sticky save button at bottom (au-dessus de la bottom-nav) */
.sticky-actions {
    position: fixed;
    bottom: 60px; /* Au-dessus de la bottom-nav */
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1001;
}

/* Add padding to body for sticky actions */
body.has-sticky-actions {
    padding-bottom: 160px; /* sticky-actions + bottom-nav */
}

/* Intervention list */
.intervention-item {
    padding: 1rem;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 1rem;
    background: white;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Mobile header */
.mobile-header .navbar {
    padding: 0.75rem 1rem;
}

/* Form labels */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Photo preview */
.photo-preview img {
    max-width: 100%;
    border-radius: 8px;
}

/* Photo field */
.photo-field {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

/* Switch toggle larger */
.form-switch .form-check-input {
    width: 3em;
    height: 1.5em;
}

/* Status colors */
.status-planifiee { background-color: #6c757d; }
.status-en-cours { background-color: #ffc107; color: #212529; }
.status-realisee { background-color: #198754; }
.status-validee { background-color: #0dcaf0; color: #212529; }
.status-annulee { background-color: #dc3545; }

/* Alert improvements */
.alert {
    border-radius: 10px;
}

/* Textarea larger for mobile */
textarea.form-control {
    min-height: 120px;
}

/* Loading state */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Planning tabs */
.planning-tabs {
    border-bottom: 2px solid #dee2e6;
}

.planning-tabs .nav-link {
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6c757d;
    background: none;
}

.planning-tabs .nav-link:hover {
    border-color: transparent;
    color: #0d6efd;
}

.planning-tabs .nav-link.active {
    border-bottom-color: #0d6efd;
    color: #0d6efd;
    font-weight: 500;
}

.planning-tabs .nav-link .badge {
    font-size: 0.7rem;
    vertical-align: middle;
}

/* Intervention en retard */
.intervention-item.intervention-retard {
    border-left-color: #dc3545;
    background: #fff5f5;
}

/* Tab pane animations */
.tab-pane {
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== PLANNING SEMAINE ========== */

.planning-header {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.planning-week-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
}

.planning-week {
    display: flex;
    gap: 8px;
    min-width: max-content;
    padding-bottom: 0.5rem;
}

.planning-day {
    flex: 0 0 120px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.planning-day-today {
    box-shadow: 0 2px 12px rgba(13, 110, 253, 0.3);
    border: 2px solid #0d6efd;
}

.planning-day-past {
    opacity: 0.7;
}

.planning-day-header {
    background: #f8f9fa;
    padding: 0.5rem;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
}

.planning-day-today .planning-day-header {
    background: #e7f1ff;
}

.planning-day-name {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6c757d;
    font-weight: 500;
}

.planning-day-number {
    display: inline-block;
    font-size: 1.1rem;
    font-weight: 600;
    min-width: 28px;
    line-height: 28px;
    border-radius: 50%;
}

.planning-day-content {
    min-height: 150px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.planning-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 100px;
    color: #dee2e6;
    font-size: 1.5rem;
}

/* Evenements planning */
.planning-event {
    display: block;
    padding: 6px 8px;
    border-radius: 6px;
    text-decoration: none;
    color: white;
    font-size: 0.8rem;
    position: relative;
    transition: transform 0.1s;
}

.planning-event:hover {
    transform: scale(1.02);
    color: white;
}

.planning-event:active {
    transform: scale(0.98);
}

.planning-event-time {
    font-weight: 600;
    font-size: 0.75rem;
}

.planning-event-title {
    font-size: 0.7rem;
    opacity: 0.9;
}

.planning-event-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: white;
    color: #dc3545;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Couleurs statuts planning */
.planning-planifiee {
    background: linear-gradient(135deg, #6c757d, #5a6268);
}

.planning-encours {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #212529;
}

.planning-realisee {
    background: linear-gradient(135deg, #198754, #157347);
}

.planning-validee {
    background: linear-gradient(135deg, #0dcaf0, #0aa2c0);
    color: #212529;
}

.planning-annulee {
    background: linear-gradient(135deg, #dc3545, #bb2d3b);
}

.planning-nonrealisable {
    background: linear-gradient(135deg, #212529, #343a40);
}

.planning-retard {
    background: linear-gradient(135deg, #dc3545, #bb2d3b) !important;
    animation: pulse-retard 2s infinite;
}

@keyframes pulse-retard {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Legende */
.planning-legend {
    background: white;
    padding: 0.75rem;
    border-radius: 8px;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
}

.legend-dot.planning-planifiee { background: #6c757d; }
.legend-dot.planning-encours { background: #ffc107; }
.legend-dot.planning-realisee { background: #198754; }
.legend-dot.planning-retard { background: #dc3545; }

/* Responsive - ecrans plus larges */
@media (min-width: 768px) {
    .planning-day {
        flex: 1;
        min-width: 0;
    }

    .planning-week {
        min-width: 100%;
    }
}

/* ========== BOTTOM NAVIGATION ========== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    border-top: 1px solid #dee2e6;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1.5rem;
    color: #6c757d;
    text-decoration: none;
    font-size: 0.75rem;
    transition: color 0.2s;
}

.bottom-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: #0d6efd;
}

.bottom-nav-item.active {
    font-weight: 600;
}

/* Ajuster le padding du body pour la bottom nav */
body {
    padding-bottom: 70px;
}
