/* ============================================
   STYLES SPÉCIFIQUES - PAGE CAMERA
   ============================================ */

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

.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);
    margin-left: auto;
    margin-right: auto;
}

.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;
}

/* Boutons de source pour la pratique */
.practice-option-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.practice-source-buttons {
    display: flex;
    gap: 10px;
    padding: 0 25px 15px 25px;
    animation: fadeIn 0.3s ease;
}

.practice-source-buttons.hidden {
    display: none;
}

.practice-source-btn {
    flex: 1;
    background: #667eea;
    color: white;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.practice-source-btn:hover {
    background: #5568d3;
    border-color: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

.practice-source-btn.selected {
    background: #764ba2;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.3);
}

/* Zone de paramétrage webcam */
.webcam-setup-zone {
    margin-top: 0;
    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: #fff;
    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;
}

.setup-crop-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    background: #000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

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

.setup-webcam-video {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    object-fit: contain;
    border-radius: 10px;
}

.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;
}

.webcam-recrop-controls {
    margin-top: 20px;
    border-top: 1px solid #e9ecef;
    width: 100%;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.webcam-recrop-controls .recrop-toggle-btn {
    margin-bottom: 0;
}

.recrop-options {
    display: none;
    margin-top: 15px;
}
.recrop-options.visible {
    display: block;
}

.recrop-options .recrop-title {
    font-size: 1em;
    font-weight: bold;
    color: #666;
    margin-bottom: 15px;
}

.recrop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
}

.recrop-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9em;
    color: #555;
}

.recrop-label input[type="range"] {
    width: 100%;
    min-height: 24px;
    cursor: pointer;
    accent-color: #667eea;
    touch-action: none;
    pointer-events: auto;
}

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

.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);
}

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

.main-content .container {
    width: 80%;
    min-width: 1200px;
    max-width: none;
}

/* Mini-titre en haut à gauche (visible après validation du setup) */
.mini-title-link {
    position: fixed;
    top: 8px;
    left: 12px;
    font-size: 1.15em;
    font-weight: bold;
    color: white;
    text-decoration: none;
    z-index: 10;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    transition: opacity 0.2s ease;
}
.mini-title-link:hover {
    opacity: 0.85;
}

/* Groupe de boutons Save + Webcam en haut à droite */
.save-buttons-group .save-state-btn {
    position: static;
}

/* Bouton Save (disquette) en haut à droite */
.save-state-btn {
    position: fixed;
    top: 8px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(102, 126, 234, 0.4);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}
.save-state-btn:hover {
    background: white;
    border-color: #667eea;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.25);
    transform: translateY(-1px);
}
.save-state-btn:active {
    transform: translateY(0);
}
.save-state-icon {
    font-size: 1.1em;
    transition: transform 0.3s ease;
}
.save-state-icon.saved {
    transform: scale(1.2);
}

/* Overlay Save - plein écran pour sauvegarder le lien */
.save-link-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100001;
    padding: 20px;
}

.save-link-overlay.hidden {
    display: none;
}

.save-link-modal {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 560px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.save-link-modal h3 {
    margin: 0 0 12px 0;
    font-size: 1.4em;
    color: #333;
}

.save-link-explanation {
    font-size: 0.95em;
    color: #555;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.save-link-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.save-link-input-row input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.85em;
    font-family: monospace;
}

.save-link-modal .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 0.95em;
}

.save-link-modal #save-link-copy-btn {
    flex-shrink: 0;
}

.btn-site-return {
    display: block;
    width: 100%;
    background: #667eea;
    color: white;
    border: 2px solid #667eea;
}

.btn-site-return:hover {
    background: #5568d3;
    color: white;
    border-color: #5568d3;
}

/* Header en dehors du contenu principal de camera */
#main-header {
    text-align: center;
    color: white;
    margin-bottom: 0;
    padding: 10px 0;
}

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

#main-header h1 .home-link {
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

#main-header h1 .home-link:hover {
    opacity: 0.8;
}

/* Section Webcam */
.webcam-section {
    width: 100%;
    background: transparent;
    border-radius: 15px;
    padding: 10px;
    position: relative;
}

/* Écran de chargement des vues - plein écran, couleur du background */
.views-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    transition: opacity 0.3s ease;
}

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

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

.views-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.views-loading-text {
    font-size: 2.2em;
    font-weight: 600;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.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;
    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: 0 10px 20px 10px;
    background: transparent;
    box-sizing: border-box;
    overflow: hidden;
}

.view-container {
    position: sticky;
    width: calc((99vw - 10px) / 2 - 20px);
    height: auto;
    top: 0;
    left: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
    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;
    align-self: flex-start;
    visibility: hidden;
    cursor: default;
}

/* Zones de grab invisibles sur les bords pour faciliter le resize */
.view-resize-grab-zone {
    position: absolute;
    z-index: 10001;
    pointer-events: auto;
    background: transparent;
}

.view-resize-grab-zone.top {
    top: -12px;
    left: 25px;
    right: 25px;
    height: 12px;
    cursor: n-resize;
}

.view-resize-grab-zone.bottom {
    bottom: -12px;
    left: 25px;
    right: 25px;
    height: 12px;
    cursor: s-resize;
}

.view-resize-grab-zone.left {
    top: 25px;
    left: -12px;
    bottom: 25px;
    width: 12px;
    cursor: w-resize;
}

.view-resize-grab-zone.right {
    top: 25px;
    right: -12px;
    bottom: 25px;
    width: 12px;
    cursor: e-resize;
}

.view-resize-grab-zone.top-left {
    top: -10px;
    left: -10px;
    width: 25px;
    height: 25px;
    cursor: nw-resize;
    z-index: 10002;
}

.view-resize-grab-zone.top-right {
    top: -10px;
    right: -10px;
    width: 25px;
    height: 25px;
    cursor: ne-resize;
    z-index: 10002;
}

.view-resize-grab-zone.bottom-left {
    bottom: -10px;
    left: -10px;
    width: 25px;
    height: 25px;
    cursor: sw-resize;
    z-index: 10002;
}

.view-resize-grab-zone.bottom-right {
    bottom: -10px;
    right: -10px;
    width: 25px;
    height: 25px;
    cursor: se-resize;
    z-index: 10002;
}

.view-container.dragging {
    cursor: grabbing !important;
}

.view-container.dragging * {
    cursor: grabbing !important;
}

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

/* Position des vues gérée dynamiquement par initMediaContainer */

.drag-handle {
    display: none;
}

.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%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border-radius: 10px;
    z-index: 1;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    cursor: default;
}

.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;
    cursor: move;
    letter-spacing: 1px;
    margin: 0;
    box-sizing: border-box;
    text-transform: uppercase;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 8px;
    position: relative;
}

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

.view-wrapper .webcam-view-title {
    cursor: move;
}

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

/* Contrôles de la vue webcam */
.webcam-view-video-zone {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 200px;
    overflow: hidden;
    border-radius: 10px;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.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;
}

.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;
}

.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;
}

.webcam-view-media-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 10px;
    z-index: 1;
}

.webcam-view-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #00ff00;
    object-fit: contain;
    border-radius: 10px;
    z-index: 1;
    display: block;
}

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

.webcam-view-countdown {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    pointer-events: none;
}

.webcam-view-countdown .countdown-content {
    pointer-events: auto;
}

.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;
}

.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);
}

/* 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;
}

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

.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);
    border-radius: 10px;
    margin-bottom: 20px;
    background: #fff;
    object-fit: contain;
    flex-shrink: 1;
}

.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;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.delay-selector button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.delay-selector button:active {
    transform: translateY(0);
}

.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;
}

.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);
    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;
}

.rotate-view-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.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;
}

.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;
}

/* Styles pour le slider double de la vue video-upload */
.video-upload-slider-container {
    position: relative;
    width: 100%;
    height: 28px;
    margin: 2px 0;
}

.video-upload-slider-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background-color: #ddd;
    border-radius: 3px;
    top: 11px;
    pointer-events: none;
}

.video-upload-slider-active {
    position: absolute;
    height: 6px;
    background-color: #667eea;
    border-radius: 3px;
    top: 11px;
    pointer-events: none;
    transition: left 0.1s ease, width 0.1s ease;
}

.video-upload-loop-start-slider,
.video-upload-loop-end-slider {
    position: absolute;
    width: 100%;
    height: 6px;
    top: 11px;
    appearance: none;
    background: transparent;
    pointer-events: auto;
    cursor: pointer;
    margin: 0;
    padding: 0;
    outline: none;
}

.video-upload-loop-start-slider {
    z-index: 3;
}

.video-upload-loop-end-slider {
    z-index: 4;
}

.video-upload-loop-start-slider::-webkit-slider-thumb,
.video-upload-loop-end-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease;
    margin-top: -5px;
    position: relative;
}

.video-upload-loop-start-slider::-webkit-slider-thumb:hover,
.video-upload-loop-end-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: #5568d3;
}

.video-upload-loop-start-slider::-webkit-slider-thumb:active,
.video-upload-loop-end-slider::-webkit-slider-thumb:active {
    transform: scale(1.2);
}

.video-upload-loop-start-slider::-moz-range-thumb,
.video-upload-loop-end-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease;
}

.video-upload-loop-start-slider::-moz-range-thumb:hover,
.video-upload-loop-end-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    background: #5568d3;
}

.video-upload-loop-start-slider::-webkit-slider-runnable-track,
.video-upload-loop-end-slider::-webkit-slider-runnable-track {
    background: transparent;
    height: 6px;
}

.video-upload-loop-start-slider::-moz-range-track,
.video-upload-loop-end-slider::-moz-range-track {
    background: transparent;
    height: 6px;
    border: none;
}

.video-upload-values-display {
    display: flex;
    justify-content: space-between;
    margin-top: 0px;
    font-size: 11px;
    color: #666;
    padding: 0 2px;
    line-height: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .setup-header h1 {
        font-size: clamp(1.1em, 5.5vw, 2.2em);
    }

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

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

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