/* GuardSync Mobile-First Interface - Optimisée pour agents de sécurité */

/* Variables mobiles spécifiques aux agents de sécurité */
:root {
    /* Design system colors - aligné avec app.css */
    --security-primary: #1e40af;
    --security-success: #059669;
    --security-warning: #d97706;
    --security-danger: #dc2626;
    --security-info: #0284c7;
    
    /* Couleurs spécifiques sécurité */
    --alert-urgent: #ef4444;     /* Rouge urgence */
    --patrol-active: #10b981;    /* Vert ronde active */
    --checkpoint-ok: #6366f1;    /* Violet checkpoint */
    --night-mode: #1e293b;       /* Mode nuit */
    
    /* Spacing pour mobile tactile */
    --mobile-padding: 1rem;
    --mobile-margin: 0.75rem;
    --touch-safe: 44px;          /* Taille minimum tactile */
    --button-large: 56px;        /* Boutons principaux */
    --input-mobile: 48px;        /* Champs de saisie */
    
    /* Typography mobile */
    --text-large: 1.125rem;      /* Texte principal */
    --text-medium: 1rem;         /* Texte secondaire */
    --text-small: 0.875rem;      /* Labels, badges */
    --text-xs: 0.75rem;          /* Aide, timestamps */
    
    /* Effects optimisés mobile */
    --border-radius-mobile: 0.75rem;
    --shadow-mobile: 0 4px 12px rgba(0,0,0,0.15);
    --transition-mobile: all 0.2s ease;
}

/* Base mobile styles */
@media (max-width: 768px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Navigation mobile */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    /* Cards responsives */
    .card {
        border-radius: var(--border-radius);
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        margin-bottom: 1rem;
        background: #ffffff;
        border: 1px solid #e9ecef;
    }
    
    .card-body {
        padding: 1.25rem;
    }
    
    .card-header {
        background: #f8f9fa;
        border-bottom: 1px solid #e9ecef;
        color: #495057;
        font-weight: 600;
    }
    
    /* Boutons plus grands sur mobile */
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1.1rem;
    }
    
    .btn-sm {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Tables responsives */
    .table-responsive {
        border: none;
    }
    
    .table {
        font-size: 0.9rem;
    }
    
    .table td, .table th {
        padding: 0.5rem;
    }
    
    /* Forms mobiles */
    .form-control, .form-select {
        padding: 0.75rem;
        font-size: 1rem;
        border-radius: var(--border-radius);
        border: 2px solid #dee2e6;
        transition: var(--transition);
    }
    
    .form-control:focus, .form-select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
    }
    
    /* Labels plus visibles */
    .form-label {
        font-weight: 600;
        margin-bottom: 0.5rem;
        color: var(--dark-color);
    }
    
    /* Breadcrumb mobile */
    .breadcrumb {
        background: none;
        padding: 0;
        margin-bottom: 1rem;
    }
    
    .breadcrumb-item {
        font-size: 0.9rem;
    }
    
    /* Headers de pages */
    h1, h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    h3, h4 {
        font-size: 1.25rem;
    }
    
    /* Badges plus lisibles */
    .badge {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        border-radius: var(--border-radius);
    }
}

/* Styles spécifiques pour l'interface agent */
.shift-card {
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
    cursor: pointer;
    margin-bottom: 1rem;
}

.shift-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.shift-card.active {
    border-left-color: var(--success-color);
    background-color: rgba(40, 167, 69, 0.05);
}

/* Cards pour les shifts */
.border-left-primary {
    border-left: 4px solid var(--primary-color) !important;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    background: #ffffff;
    border: 1px solid #e9ecef;
}

.border-left-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}

.border-left-primary .card-body {
    padding: 1.25rem;
}

.border-left-primary .card-title {
    color: #212529;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.border-left-primary .card-text {
    color: #6c757d;
    line-height: 1.4;
}

.shift-time {
    font-size: 0.9rem;
    color: #495057;
    font-weight: 500;
}

.shift-status-badge {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: 1rem;
}

.round-card {
    border: 2px solid #dee2e6;
    transition: var(--transition);
}

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

.round-card.border-success {
    border-color: var(--success-color) !important;
    border-width: 3px !important;
}

.round-card.border-warning {
    border-color: var(--warning-color) !important;
    border-width: 3px !important;
}

/* Interface d'exécution de ronde - Mobile optimized */
@media (max-width: 768px) {
    .execute-round-controls {
        position: sticky;
        top: 0;
        z-index: 100;
        background: white;
        padding: 1rem;
        border-bottom: 2px solid #dee2e6;
        margin: -1rem -1rem 1rem -1rem;
    }
    
    .round-timer {
        background: linear-gradient(135deg, var(--success-color), #20c997);
        color: white;
        border-radius: var(--border-radius);
        padding: 1rem;
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .checklist-item {
        padding: 1rem;
        border: 2px solid #dee2e6;
        border-radius: var(--border-radius);
        margin-bottom: 1rem;
        background: white;
        transition: var(--transition);
    }
    
    .checklist-item:hover {
        border-color: var(--primary-color);
        background: rgba(0,123,255,0.05);
    }
    
    .checklist-item.checked {
        border-color: var(--success-color);
        background: rgba(40,167,69,0.1);
    }
    
    .form-check-input {
        width: 1.5rem;
        height: 1.5rem;
        margin-top: 0;
        margin-right: 1rem;
    }
    
    .form-check-label {
        font-size: 1rem;
        line-height: 1.5;
        cursor: pointer;
    }
    
    /* QR Points - Mobile */
    .qr-point-card {
        text-align: center;
        padding: 1.5rem 1rem;
        background: linear-gradient(145deg, #f8f9fa, white);
        border: 2px solid #dee2e6;
        border-radius: var(--border-radius);
        transition: var(--transition);
    }
    
    .qr-point-card:hover {
        border-color: var(--warning-color);
        transform: translateY(-2px);
    }
    
    .qr-code-display {
        background: white;
        border: 3px solid #dee2e6;
        border-radius: var(--border-radius);
        padding: 2rem;
        margin: 1rem 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 120px;
    }
    
    .qr-scanner-btn {
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
        border-radius: var(--border-radius);
        margin-top: 1rem;
    }
}

/* Dashboard styles généraux */
.dashboard-header {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    color: #212529;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.dashboard-header h3 {
    color: #212529;
    font-weight: 600;
}

.dashboard-header .opacity-75 {
    color: #6c757d !important;
    opacity: 1 !important;
}

/* Dashboard mobile */
@media (max-width: 768px) {
    
    .dashboard-time {
        font-size: 2rem;
        font-weight: 600;
        text-align: center;
        margin-bottom: 0.5rem;
        color: var(--primary-color);
    }
    
    .dashboard-date {
        text-align: center;
        opacity: 0.8;
        font-size: 1rem;
        color: #6c757d;
        font-weight: 500;
    }
    
    /* Cartes d'action optimisées pour agents */
    .quick-action-card {
        text-align: center;
        padding: var(--mobile-padding);
        height: 120px;
        border: 2px solid #e2e8f0;
        border-radius: var(--border-radius-mobile);
        background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
        box-shadow: var(--shadow-mobile);
        transition: var(--transition-mobile);
        cursor: pointer;
        position: relative;
        overflow: hidden;
    }
    
    .quick-action-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: linear-gradient(90deg, var(--security-primary) 0%, var(--security-success) 100%);
        opacity: 0;
        transition: var(--transition-mobile);
    }
    
    .quick-action-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(0,0,0,0.12);
        border-color: var(--primary-color);
    }
    
    .quick-action-icon {
        font-size: 3rem;
        margin-bottom: 1rem;
        display: block;
    }
    
    .quick-action-title {
        font-size: 1.25rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
        color: #212529;
    }
    
    .quick-action-description {
        color: #6c757d;
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
        line-height: 1.4;
    }
}

/* Sections vides - amélioration lisibilité */
.text-center .text-muted {
    color: #6c757d !important;
}

.text-center h6.text-muted {
    color: #495057 !important;
    font-weight: 600;
}

/* Amélioration des badges */
.badge.bg-success {
    background-color: #198754 !important;
    color: white;
}

.badge.bg-warning {
    background-color: #fd7e14 !important;
    color: white;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
    color: white;
}

.badge.bg-info {
    background-color: #0dcaf0 !important;
    color: #212529;
}

/* Status indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.status-indicator.active {
    background: rgba(40,167,69,0.15);
    color: var(--success-color);
}

.status-indicator.pending {
    background: rgba(255,193,7,0.15);
    color: #e0a800;
}

.status-indicator.completed {
    background: rgba(0,123,255,0.15);
    color: var(--primary-color);
}

/* Loading states */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(0,0,0,0.25);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

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

/* Utility classes pour mobile */
@media (max-width: 768px) {
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
    
    .mobile-stack > * {
        margin-bottom: 1rem;
    }
    
    .mobile-center {
        text-align: center;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    /* Espacement mobile */
    .mb-mobile {
        margin-bottom: 1.5rem;
    }
    
    .mt-mobile {
        margin-top: 1.5rem;
    }
    
    .p-mobile {
        padding: 1rem;
    }
    
    /* Touch targets plus grands */
    .btn, .form-control, .form-select, .form-check-input {
        min-height: 44px;
    }
    
    .btn {
        border-radius: var(--border-radius);
        font-weight: 500;
        transition: var(--transition);
    }
    
    .btn:active {
        transform: scale(0.98);
    }
}


/* Animations pour feedback utilisateur */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 0.6s ease-in-out;
}

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

.slide-in {
    animation: slideIn 0.4s ease-out;
}

/* Styles spécifiques agents de sécurité */
.security-status-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    z-index: 1000;
    background: linear-gradient(90deg, var(--patrol-active) 0%, var(--checkpoint-ok) 100%);
}

.security-status-bar.alert {
    background: linear-gradient(90deg, var(--alert-urgent) 0%, var(--security-warning) 100%);
    animation: pulse-urgent 2s infinite;
}

@keyframes pulse-urgent {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Boutons d'urgence */
.emergency-btn {
    background: linear-gradient(135deg, var(--alert-urgent) 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius-mobile);
    padding: var(--mobile-padding);
    font-weight: 700;
    font-size: var(--text-large);
    box-shadow: var(--shadow-mobile);
    transition: var(--transition-mobile);
    position: relative;
    overflow: hidden;
}

.emergency-btn:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transition: width 0.3s ease, height 0.3s ease;
    transform: translate(-50%, -50%);
}

.emergency-btn:active:before {
    width: 300px;
    height: 300px;
}

/* Modes spéciaux agents */
.night-mode {
    background: var(--night-mode) !important;
    color: #e2e8f0 !important;
}

.night-mode .card {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}

.night-mode .quick-action-card {
    background: linear-gradient(145deg, #334155 0%, #475569 100%) !important;
    border-color: #64748b !important;
}

.patrol-active-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: var(--patrol-active);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(16,185,129,0.5);
    animation: patrol-pulse 2s infinite;
    z-index: 1001;
}

@keyframes patrol-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

/* Badges de statut agents */
.status-badge {
    padding: 0.5rem 0.75rem;
    border-radius: 2rem;
    font-size: var(--text-small);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge.on-duty {
    background: rgba(16,185,129,0.1);
    color: var(--patrol-active);
    border: 2px solid var(--patrol-active);
}

.status-badge.off-duty {
    background: rgba(100,116,139,0.1);
    color: #64748b;
    border: 2px solid #94a3b8;
}

.status-badge.emergency {
    background: rgba(239,68,68,0.1);
    color: var(--alert-urgent);
    border: 2px solid var(--alert-urgent);
    animation: urgent-blink 1s infinite;
}

@keyframes urgent-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Amélioration accessibilité tactile */
.touch-optimized {
    min-height: var(--touch-safe);
    min-width: var(--touch-safe);
}

.large-touch {
    min-height: var(--button-large);
    min-width: var(--button-large);
    padding: var(--mobile-padding);
}

/* Feedback tactile visuel */
.tap-feedback {
    position: relative;
    overflow: hidden;
}

.tap-feedback:active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: tap-ripple 0.4s ease;
}

@keyframes tap-ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 100px;
        height: 100px;
        opacity: 0;
    }
}