/**
 * Styles pour le module de pointage géolocalisé
 */

/* Panel principal */
.pointage-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 900;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 320px;
    max-width: 380px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    will-change: transform, box-shadow;
}

.pointage-panel:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
    transform: translateY(-2px);
}

/* Header du panel */
.pointage-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.pointage-header:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.pointage-header:active {
    transform: scale(0.98);
}

/* Badge de notification */
.notification-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    animation: badgePulse 2s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Indicateur de statut */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.header-text {
    flex: 1;
    font-weight: 600;
    font-size: 16px;
}

.status-text {
    opacity: 0.9;
    font-weight: 500;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Corps du panel */
.pointage-body {
    padding: 20px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease-in-out,
                padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.pointage-body.expanded {
    max-height: 800px;
    opacity: 1;
    padding: 20px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Alerte d'information */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

.alert svg {
    flex-shrink: 0;
}

/* Informations de temps */
.time-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.time-slot {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.time-slot::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.time-slot:hover::before {
    left: 100%;
}

.time-slot:hover {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.time-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.time-value {
    font-size: 24px;
    font-weight: 700;
    color: #9ca3af;
    font-family: 'Courier New', monospace;
    margin-bottom: 8px;
}

.time-value.active {
    color: #22c55e;
}

/* Badge de statut */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.success {
    background: #dcfce7;
    color: #166534;
}

.status-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

/* Boutons d'action */
.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.btn-pointage {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

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

.btn-pointage:hover:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

.btn-pointage:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-pointage:active:not(:disabled) {
    transform: translateY(-1px) scale(0.98);
    transition: all 0.1s;
}

.btn-pointage:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Animation de rappel pour le bouton début */
@keyframes pulseReminder {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    50% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 8px rgba(34, 197, 94, 0);
    }
}

@keyframes gentleShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.btn-debut {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

/* Classe pour l'animation de rappel */
.btn-debut.needs-attention {
    animation: pulseReminder 2s ease-in-out infinite, gentleShake 3s ease-in-out infinite;
}

.btn-debut:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    animation: none; /* Stop l'animation au survol */
}

.btn-fin {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.btn-fin:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.btn-pointage svg {
    flex-shrink: 0;
}

/* Pied du panel */
.info-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 13px;
    color: #6b7280;
}

.info-footer svg {
    flex-shrink: 0;
    color: #9ca3af;
}

/* Animation de chargement */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Effet de succès */
@keyframes successPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.time-slot.success-animation {
    animation: successPulse 0.6s ease-out;
}

/* Smooth scrolling */
.pointage-body {
    scroll-behavior: smooth;
}

/* Adaptation responsive */
@media (max-width: 768px) {
    /* Panel flottant compact en haut - Positionné sous la topbar */
    .pointage-panel {
        top: 74px; /* En dessous de la topbar (64px) + 10px marge */
        right: 10px;
        left: 10px;
        max-width: none;
        min-width: auto;
        border-radius: 12px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        z-index: 100; /* Sous la topbar mais au-dessus du contenu */
    }

    .pointage-panel:hover {
        transform: none;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    }

    /* Header compact */
    .pointage-header {
        padding: 10px 14px;
        border-radius: 12px 12px 0 0;
    }

    .header-text {
        font-size: 14px;
    }

    .status-text {
        font-size: 11px;
    }

    .status-indicator {
        width: 8px;
        height: 8px;
    }

    .notification-badge {
        top: 6px;
        right: 6px;
        font-size: 9px;
        padding: 2px 5px;
    }

    .toggle-btn {
        padding: 2px;
    }

    .toggle-btn svg {
        width: 14px;
        height: 14px;
    }

    /* Body ultra-compact */
    .pointage-body {
        padding: 0;
        max-height: 0;
    }

    .pointage-body.expanded {
        padding: 12px 14px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Time info en ligne sur mobile */
    .time-info {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 12px;
    }

    .time-slot {
        padding: 10px 8px;
        border-radius: 8px;
    }

    .time-slot::before {
        display: none; /* Désactiver l'effet shimmer sur mobile */
    }

    .time-slot:hover {
        transform: none;
        background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    }

    .time-label {
        font-size: 10px;
        margin-bottom: 4px;
        letter-spacing: 0.3px;
    }

    .time-value {
        font-size: 16px;
        margin-bottom: 4px;
    }

    .status-badge {
        font-size: 9px;
        padding: 2px 6px;
        border-radius: 8px;
    }

    /* Boutons compacts */
    .actions {
        gap: 8px;
        margin-bottom: 12px;
    }

    .btn-pointage {
        padding: 10px 14px;
        font-size: 12px;
        border-radius: 8px;
    }

    .btn-pointage svg {
        width: 16px;
        height: 16px;
        margin-right: 6px;
    }

    .btn-pointage::before {
        display: none; /* Désactiver l'effet d'onde sur mobile */
    }

    .btn-pointage:hover:not(:disabled) {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .btn-pointage:active:not(:disabled) {
        transform: scale(0.96);
    }

    /* Footer compact */
    .info-footer {
        padding: 8px 10px;
        font-size: 11px;
        border-radius: 6px;
    }

    .info-footer svg {
        width: 14px;
        height: 14px;
    }

    /* Alert compact */
    .alert {
        padding: 10px 12px;
        font-size: 12px;
        border-radius: 8px;
        margin-bottom: 0;
    }

    .alert svg {
        width: 18px;
        height: 18px;
    }

    /* Animation ajustée pour mobile - plus subtile */
    .btn-debut.needs-attention {
        animation: pulseReminderMobile 3s ease-in-out infinite;
    }

    @keyframes pulseReminderMobile {
        0%, 100% {
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 0 rgba(34, 197, 94, 0.5);
        }
        50% {
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 4px rgba(34, 197, 94, 0);
        }
    }
}

/* Tablette */
@media (min-width: 769px) and (max-width: 1024px) {
    .pointage-panel {
        top: 70px;
        right: 15px;
        min-width: 300px;
        max-width: 340px;
    }
}

/* Desktop large */
@media (min-width: 1440px) {
    .pointage-panel {
        top: 90px;
        right: 30px;
        min-width: 360px;
        max-width: 420px;
    }

    .pointage-body {
        padding: 24px;
    }

    .time-slot {
        padding: 18px;
    }

    .btn-pointage {
        padding: 16px 24px;
        font-size: 15px;
    }
}

/* Amélioration de l'accessibilité */
.btn-pointage:focus {
    outline: 2px solid #22c55e;
    outline-offset: 2px;
}

.toggle-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Thème sombre (optionnel) */
@media (prefers-color-scheme: dark) {
    .pointage-panel {
        background: #1f2937;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }

    .time-slot {
        background: #374151;
    }

    .time-slot:hover {
        background: #4b5563;
    }

    .time-label {
        color: #9ca3af;
    }

    .time-value {
        color: #6b7280;
    }

    .info-footer {
        background: #374151;
        color: #9ca3af;
    }

    .alert-info {
        background: #1e3a5f;
        color: #93c5fd;
    }
}

/* Transition douce pour le rotate */
.rotate-180 {
    transform: rotate(180deg);
}

.transition-transform {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
