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

/* Pré-page de paramétrage */
.setup-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.setup-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}


.setup-header {
    text-align: center;
    margin-bottom: 40px;
}

.setup-header h1 {
    font-size: clamp(1.5em, 8vw, 3em);
    color: #667eea;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}


.setup-header h1 .home-link,
header h1 .home-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.setup-header h1 .home-link:hover,
header h1 .home-link:hover {
    opacity: 0.8;
}

.setup-content h2 {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 30px;
    text-align: center;
}

.setup-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setup-option {
    background: #f8f9fa;
    border: 3px solid #e9ecef;
    border-radius: 15px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
}

.setup-option:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.setup-option:active {
    transform: translateY(0);
}

.option-title {
    font-size: 1.3em;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px;
}

.option-description {
    font-size: 1em;
    color: #666;
    line-height: 1.5;
}

/* Zone de paramétrage webcam */
.webcam-setup-zone {
    margin-top: 40px;
    animation: fadeIn 0.3s ease;
}

.webcam-setup-zone.hidden {
    display: none;
}

.webcam-setup-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px dashed #fff;
    border-radius: 15px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.webcam-setup-placeholder:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.placeholder-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.placeholder-text {
    font-size: 1.5em;
    font-weight: 600;
}

.webcam-setup-preview {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.webcam-video-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    min-height: 0;
}

.webcam-setup-preview.hidden {
    display: none;
}

.setup-webcam-video {
    height: auto;
    border-radius: 10px;
    background: #000;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    object-fit: contain;
    display: block;
    margin-left: auto;
    margin-right: auto;
    /* Les dimensions width/max-width/max-height seront gérées dynamiquement par JavaScript selon la rotation */
}

.webcam-setup-instructions {
    margin-bottom: 30px;
}

.webcam-setup-instructions p {
    font-size: 1.1em;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
}

.webcam-rotation-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.rotation-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.rotation-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.rotation-btn:active {
    transform: translateY(0);
}

.start-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 20px 60px;
    font-size: 1.5em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    margin-top: 20px;
    width: 100%;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.start-btn:active {
    transform: translateY(-1px);
}

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

/* Contenu principal */
.main-content {
    min-height: 100vh;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 15px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header h1 .home-link {
    color: white;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Section Webcam */
.webcam-section {
    background: white;
    border-radius: 15px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

/* Écran de chargement des vues */
.views-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    border-radius: 15px;
    transition: opacity 0.3s ease;
}

.views-loading-overlay.hidden {
    display: none;
}

.views-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.views-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e9ecef;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.views-loading-text {
    font-size: 16px;
    color: #667eea;
    font-weight: 500;
}

.webcam-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-items: center;
}

.webcam-display-container {
    display: flex;
    flex-direction: row;
    gap: 15px;
    width: 100%;
    justify-content: center;
    align-items: flex-start;
    /* Ne pas interférer avec la vue flottante */
    pointer-events: none;
    min-height: 0;
}

.webcam-display-container > * {
    pointer-events: auto;
}

.delayed-wrapper.hidden {
    display: none;
}

.delayed-black-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 10px;
    z-index: 1;
}

.views-boundary-container {
    position: relative;
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    min-width: 400px;
    min-height: 225px;
    border: 3px solid rgba(255, 0, 0, 0);
    margin-bottom: 10px;
    margin-left: calc(50% - 50vw + 10px);
    margin-right: calc(50% - 50vw + 10px);
    padding: 10px;
    background: transparent;
    box-sizing: border-box;
    overflow: hidden;
}

.view-container {
    position: sticky;
    width: calc((99vw - 10px) / 2 - 20px);
    height: auto; /* La hauteur sera définie par JavaScript pour être égale à la largeur */
    top: 0;
    left: 0;
    overflow: visible;
    border-radius: 10px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    border: 3px solid #f0f0f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 200px;
    background: #ffffff;
    z-index: 1000;
    cursor: move;
    align-self: flex-start;
    visibility: hidden; /* Cachées par défaut, affichées par JavaScript après positionnement */
}

.view-container:hover {
    border-color: #e0e0e0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

#view-container-2 {
    left: calc((99vw - 10px) / 2 + 10px);
}

.drag-handle {
    display: none; /* Caché car toute la vue est maintenant draggable */
}

.drag-handle:hover {
    background: #764ba2;
}

.drag-handle:active {
    background: #667eea;
}

.drag-icon {
    width: 18px;
    height: 18px;
    user-select: none;
    pointer-events: none;
    filter: brightness(0) invert(1);
}

.empty-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 10px;
    z-index: 1;
}

.empty-view.hidden {
    display: none;
}

.add-view-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #667eea;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, background 0.2s ease;
    z-index: 10;
    position: relative;
}

.add-view-btn:hover {
    transform: scale(1.1);
    background: #764ba2;
}

.add-icon {
    font-size: 60px;
    color: white;
    line-height: 1;
    font-weight: bold;
}

.view-wrapper {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    border-radius: 10px;
    z-index: 1;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.webcam-view-title {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    color: #6c757d;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    border-radius: 0;
    flex-shrink: 0;
    z-index: 10;
    pointer-events: auto;
    user-select: none;
    letter-spacing: 1px;
    margin: 0;
    box-sizing: border-box;
    text-transform: uppercase;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 8px;
}

.view-wrapper * {
    pointer-events: auto;
}

.view-wrapper #webcam,
.view-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 10px;
    overflow: hidden;
}

/* Contrôles de la vue webcam */
/* Zone vidéo (en haut) */
.webcam-view-video-zone {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 200px;
    overflow: hidden; /* Empêcher le débordement lors de la rotation */
    border-radius: 10px;
    display: flex;
    align-items: stretch; /* Étirer pour remplir toute la hauteur */
    justify-content: stretch; /* Étirer pour remplir toute la largeur */
}

/* Zone options (en bas) */
.webcam-view-options-zone {
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    flex-shrink: 0;
    margin-top: 8px;
}

.webcam-view-delay-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    position: relative;
}

.webcam-view-delay-control label {
    color: #333;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.5;
    height: 18px;
}

/* Wrapper pour le select avec la flèche */
.webcam-view-delay-select-wrapper {
    position: relative;
    width: 100%;
}

.webcam-view-delay-select {
    padding: 10px 35px 10px 12px;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    height: 38px; /* Hauteur fixe pour éviter les variations */
}

/* Flèche personnalisée sur le wrapper */
.webcam-view-delay-select-wrapper::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #666;
    pointer-events: none;
    z-index: 1;
}

.webcam-view-delay-select:hover {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.webcam-view-delay-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.webcam-view-delay-select option {
    background: white;
    color: #333;
    padding: 10px;
}

/* Wrapper pour la vidéo et l'image décalée qui gère la rotation */
.webcam-view-media-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Empêcher le débordement */
    border-radius: 10px;
    z-index: 1;
}

/* Vidéo et image décalée de la vue webcam */
.webcam-view-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #00ff00; /* Fond vert pour distinguer l'objet vidéo */
    object-fit: contain; /* Garder les proportions sans troncature */
    border-radius: 10px;
    z-index: 1;
    display: block;
}

.webcam-view-delayed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Garder les proportions sans troncature */
    border-radius: 10px;
    z-index: 20;
    display: block;
}

/* Compte à rebours de la vue webcam (même style que l'original) */
.webcam-view-countdown {
    position: absolute;
    top: 0; /* Commencer en haut */
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Plus transparent pour voir la vidéo en arrière-plan */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50; /* Au-dessus de la vidéo (z-index: 1) mais sous les contrôles (z-index: 150) */
    pointer-events: none; /* Permettre les clics sur les contrôles au-dessus */
}

.webcam-view-countdown .countdown-content {
    pointer-events: auto; /* Réactiver les événements sur le contenu du compte à rebours */
}

.webcam-view-countdown .countdown-content {
    text-align: center;
    color: white;
}

.webcam-view-countdown .countdown-text {
    font-size: 18px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.webcam-view-countdown .countdown-number {
    font-size: 72px;
    font-weight: bold;
    line-height: 1;
    margin: 20px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.webcam-view-countdown .countdown-label {
    font-size: 16px;
    opacity: 0.8;
    margin-top: 10px;
}

.webcam-wrapper.portrait {
    aspect-ratio: 9 / 16;
    max-width: 585px;
    width: 100%;
    max-height: 62vh;
}

#webcam {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    background: #fff;
    display: block;
    object-fit: contain;
    transform-origin: center center;
    transform: rotate(0deg);
}

.delayed-image {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: contain;
    transform-origin: center center;
    transform: rotate(0deg);
    background: #fff;
    display: block;
}

.countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(5px);
    pointer-events: none;
}

.countdown-content {
    text-align: center;
    color: white;
}

.countdown-text {
    font-size: 0.9em;
    margin-bottom: 10px;
    opacity: 0.9;
}

.countdown-number {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
    margin: 10px 0;
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
    animation: pulse-countdown 1s infinite;
}

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

.countdown-label {
    font-size: 0.8em;
    opacity: 0.8;
}

.webcam-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.delay-control {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 500px;
}

.delay-control label {
    font-weight: 600;
    color: #555;
}

.delay-control select {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    font-size: 1em;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s ease;
}

.delay-control select:hover {
    border-color: #667eea;
}

.delay-control select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.recording-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.recording-timer {
    font-weight: bold;
    font-size: 1.1em;
    margin-left: 10px;
    color: #e74c3c;
    font-family: 'Courier New', monospace;
}

.recording-status {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e74c3c;
    font-weight: 600;
}

.recording-indicator {
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.processing-spinner-large {
    width: 40px;
    height: 40px;
    border: 4px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.recording-indicator-small {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 1.5s infinite;
    vertical-align: middle;
}

.recording-item-active {
    border-color: #667eea !important;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

/* Boutons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(149, 165, 166, 0.4);
}

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

/* Section Enregistrements */
.recordings-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.recordings-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.recordings-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.recording-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
}

.recording-item:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.recording-thumbnail {
    width: 100%;
    height: 150px;
    background: #000;
    border-radius: 8px;
    margin-bottom: 10px;
    object-fit: cover;
}

.processing-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
}

.recording-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.recording-title {
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

.recording-date {
    font-size: 0.85em;
    color: #666;
}

.recording-duration {
    font-size: 0.85em;
    color: #667eea;
    font-weight: 600;
}

.recording-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.recording-actions .btn {
    padding: 8px 16px;
    font-size: 0.9em;
    flex: 1;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px;
    font-style: italic;
    grid-column: 1 / -1;
}

.hidden {
    display: none !important;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.setup-modal {
    max-width: 600px;
}


.modal-content {
    background: white;
    border-radius: 15px;
    padding: 15px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh; /* 90% de la hauteur de la fenêtre */
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 0px;
    font-size: 2em;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #333;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #333;
    flex-shrink: 0;
}

.close-view-selector {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 2em;
    font-weight: bold;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.close-view-selector:hover {
    color: #333;
}

.view-selector-content {
    max-width: 500px;
}

.view-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.view-option-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1em;
    text-align: left;
}

.view-option-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.view-icon {
    font-size: 2em;
}

.view-label {
    font-weight: 500;
}

#modal-video {
    width: 100%;
    max-height: calc(90vh - 150px); /* 90vh moins l'espace pour le titre, padding et boutons */
    border-radius: 10px;
    margin-bottom: 20px;
    background: #fff;
    object-fit: contain;
    flex-shrink: 1;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-shrink: 0;
    margin-top: auto;
}

.audio-delay-controls {
    margin: 20px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.audio-delay-controls label {
    font-weight: 600;
    color: #333;
}

.delay-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.delay-selector input {
    width: 60px;
    text-align: center;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
}

.delay-selector button {
    min-width: 40px;
    padding: 8px 15px;
}

.delayed-video-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #ddd;
}

.delayed-video-container h4 {
    margin-bottom: 15px;
    color: #333;
}

#delayed-video {
    width: 100%;
    max-height: calc(90vh - 300px);
    border-radius: 10px;
    margin-bottom: 15px;
    background: #fff;
    object-fit: contain;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    .recording-controls {
        flex-direction: column;
        width: 100%;
    }

    .recording-controls .btn {
        width: 100%;
    }

    .recordings-list {
        grid-template-columns: 1fr;
    }
}

/* Handle de redimensionnement unique en bas à droite */

.close-view-btn {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(220, 53, 69, 0.8);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    transition: background 0.2s ease, opacity 0.2s ease;
    padding: 0;
    margin: 0;
    opacity: 1;
}

.close-view-btn:hover {
    background: rgba(220, 53, 69, 0.95);
    opacity: 1;
}

.close-view-btn:active {
    background: rgba(220, 53, 69, 0.9);
}

.close-icon {
    font-size: 16px;
    color: white;
    line-height: 1;
    user-select: none;
    pointer-events: none;
    font-weight: 600;
    font-weight: bold;
}

.rotate-view-btn {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.5); /* Fond semi-transparent */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 0;
    margin: 0;
    pointer-events: auto;
    transition: background 0.2s ease;
}

.rotate-view-btn .rotate-icon {
    transform: scaleY(-1) !important; /* Miroir vertical de l'icône */
}

.rotate-view-btn:hover {
    background: rgba(0, 0, 0, 0.7); /* Plus opaque au survol */
}

.rotate-view-btn:active {
    background: rgba(0, 0, 0, 0.8);
}

.rotate-icon {
    font-size: 24px;
    color: white;
    font-weight: bold;
    line-height: 1;
    user-select: none;
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.resize-handle {
    display: none; /* Caché car tous les bords sont maintenant resizables */
}

.resize-handle:hover {
    background: #764ba2;
}

.resize-handle:active {
    background: #5a4fcf;
}

.resize-icon {
    font-size: 20px;
    color: white;
    line-height: 1;
    user-select: none;
    pointer-events: none;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

