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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    --bg-color: #ffffff;
    --title-color: #333;
    --light-grey: #ccc;
    --notif-color: #b8b8b8;

    background: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.2s linear;
}

body.dark {
    --bg-color: #071023;
    --title-color: #ddd;
    --light-grey: #555;
    --notif-color: #000000;
}

body.dragging {
    background: rgba(0, 102, 204, 0.1);
}

.hidden { display: none !important; }

/* -----------------------------------------------------
   TITLE
----------------------------------------------------- */
.title {
    text-align: center;
    margin-top: 30px;
    color: var(--title-color);
}

/* -----------------------------------------------------
   DOWNLOAD BUTTON
----------------------------------------------------- */
.download-btn {
    display: inline-block;
    padding: 12px 24px;
    margin: 15px auto 25px auto;
    background: var(--light-grey);
    color: var(--title-color);
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
}

.download-btn:hover {
    background-color: #e0e0e0;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

body.dark .download-btn {
    background: #1f2937;
}

body.dark .download-btn:hover {
    background: #374151;
}

/* -----------------------------------------------------
   TOP BAR (DARK MODE TOGGLE)
----------------------------------------------------- */
.infos {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 20px 30px;
    z-index: 100;
}

.checkbox {
    opacity: 0;
    position: absolute;
}

.checkbox-label {
    background-color: #111;
    width: 50px;
    height: 26px;
    border-radius: 50px;
    padding: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.fa-moon { color: #f1c40f; }
.fa-sun { color: #f39c12; }

.checkbox-label .ball {
    background-color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.2s linear;
}

.checkbox:checked + .checkbox-label .ball {
    transform: translateX(24px);
}

/* -----------------------------------------------------
   USER COUNT + RELOAD
----------------------------------------------------- */
.user-count {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--title-color);
    z-index: 101;
}

#reload {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    color: var(--title-color);
    font-size: 1.2rem;
}

#reload:hover { background-color: var(--light-grey); }

#reload:hover i {
    transform: rotate(60deg);
    transition: transform 0.3s ease;
}

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

#reload i.rotate {
    animation: spin 0.5s ease-in-out;
}

.footer {
    display: none;
}

/* -----------------------------------------------------
   CENTRAL WRAPPER
----------------------------------------------------- */
.center-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin-top: 65px;
    gap: 20px;
}

/* -----------------------------------------------------
   CAMERA SELECTOR
----------------------------------------------------- */
#cameraOption {
    width: 100%;
    height: 38px;
    padding: 5px 12px;
    background: var(--light-grey);
    border: 2px solid var(--title-color);
    border-radius: 25px;
    color: var(--title-color);
}

/* -----------------------------------------------------
   VIDEO PREVIEW
----------------------------------------------------- */
.video-container {
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.video-container video,
.video-container canvas {
    width: 100%;
    display: block;
}

.inversed { transform: scaleX(-1); }

.timerOverlay {
    background: rgba(0, 0, 0, 0.3);
    position: absolute;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 5rem;
    font-weight: bold;
}

/* -----------------------------------------------------
   CAPTION INPUT
----------------------------------------------------- */
#caption {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--light-grey);
    border-radius: 5px;
    background-color: var(--bg-color);
    color: var(--title-color);
}

/* -----------------------------------------------------
   FLOATING BUTTONS
----------------------------------------------------- */
.buttons-box {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.floating-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background-color: #ffffffcc;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.floating-button img { width: 28px; opacity: 0.8; }
.floating-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

/* Validation buttons */
#valid { background-color: green; }
#delete { background-color: red; }

/* -----------------------------------------------------
   NOTIFICATIONS
----------------------------------------------------- */
.toolbox {
    position: absolute;
    bottom: 20px;
    right: 20px;
}

.notification {
    display: flex;
    align-items: center;
    background: var(--notif-color);
    padding: 10px 15px;
    border-radius: 8px;
    color: var(--title-color);
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    gap: 10px;
}

.notification img {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    object-fit: cover;
}

/* -----------------------------------------------------
   RESPONSIVE
----------------------------------------------------- */
@media (max-width: 660px) {
    .infos {
        position: static;
        display: flex;
        justify-content: center;
        margin-top: 15px;
        width: auto;
        padding: 0;
    }

    .checkbox-container {
        position: static;
        margin: 10px 0;
    }

    .user-count {
        position: static;
        display: flex;
        justify-content: center;
        margin: 10px 0 0 0;
        text-align: center;
    }

    .center-wrapper {
        margin-top: 20px;
        width: 100%;
    }

    #cameraOption {
        width: 90%;
    }

    #caption {
        width: 100%;
        max-width: 95%;
        font-size: 16px;
        margin: 10px auto;
    }
    .header {
        display: none;
    }
    .top-bar {
        display: flex;
        justify-content: space-around;
        width: 100%;
    }
    .footer {
        display: flex;
        flex-direction: column;
    }
}
