﻿/* ---------------------------------------------------
   Variables de tema
--------------------------------------------------- */
:root {
    --primary-color: #0d283d;
    --secondary-color: #0B273D;
    --accent-color: #007BFF;
    --disabled-color: #ccc;
    --danger-color: #f54b33;
    --text-color: #fefefe;
    --font-size-large: 18px;
    --font-size-medium: 16px;
    --font-size-small: 0.95rem;
    --border-radius: 5px;
    --padding: 15px;
    --margin: 10px;
}

/* ---------------------------------------------------
   Contenedor principal de ClockIn (logo + QR/scanner)
--------------------------------------------------- */
.container {
    height: calc(100vh - 10vw);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 3vh 0.5rem 0 0.5rem;
    text-align: center;
    box-sizing: border-box;
}

/* ---------------------------------------------------
   Agrupa logo, QR/scanner y contenido inferior
--------------------------------------------------- */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

/* ---------------------------------------------------
   Logo responsivo y separación unificada
--------------------------------------------------- */
.logo,
.logo-row {
    max-width: 55vw;
    display: block;
    margin: 0 auto 0.75rem;
}

/* ---------------------------------------------------
   Wrappers para QR y Scanner
--------------------------------------------------- */
.qr-container,
.scanner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0 auto;
    width: 75%;
    box-sizing: border-box;
    flex: none !important;
}

/* ---------------------------------------------------
   Caja cuadrada responsiva común (QR y Scanner)
--------------------------------------------------- */
.responsive-square {
    width: min(80vw, 320px) !important;
    aspect-ratio: 1 / 1 !important;
    position: relative;
    margin: 0 auto;
    overflow: hidden;
}

    .responsive-square > img,
    .responsive-square > video,
    .scanner-container.responsive-square video,
    .scanner-container.responsive-square canvas {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        max-width: none !important;
        max-height: none !important;
    }

/* ---------------------------------------------------
   Contenido bajo el QR/scanner
--------------------------------------------------- */
.centered-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
}

/* ---------------------------------------------------
   Mensajes y dropdowns
--------------------------------------------------- */
.alert {
    margin: 0.5rem 0;
    padding: 0.6rem 1rem;
    text-align: center;
    font-size: 1rem;
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
}

.qr-dropdown-spacing {
    margin: 0.5rem 0;
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
}

.pause-dropdown {
    width: 100%;
    height: 2.5rem;
    padding: 0.5rem;
    font-size: 1rem;
    box-sizing: border-box;
}

/* ---------------------------------------------------
   Botón de fichar movilidad
--------------------------------------------------- */
.mobility-button {
    margin-top: 0.75rem;
    background-color: var(--secondary-color);
    color: var(--text-color);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    width: 100%;
    max-width: 320px;
    border: none;
    border-radius: 12px;
    text-align: center;
    box-sizing: border-box;
}

/* ---------------------------------------------------
   Botones generales
--------------------------------------------------- */
.button,
.button-complementary,
.back-button {
    width: 62%;
    padding: var(--padding);
    margin: var(--margin) 0;
    font-size: var(--font-size-large);
    font-weight: bold;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-align: center;
    color: var(--text-color);
    box-sizing: border-box;
}

.button {
    background-color: var(--primary-color);
}

.button-complementary {
    background-color: #992e26;
}

.back-button {
    background-color: var(--danger-color);
}

.button:disabled {
    background-color: var(--disabled-color);
    cursor: not-allowed;
}

/* ---------------------------------------------------
   Info fija, navegación y layout general
--------------------------------------------------- */
.version-info {
    position: fixed;
    bottom: 30px;
    left: 10px;
    font-size: 0.8rem;
    color: #666;
    z-index: 9999;
}

.page-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

.header {
    margin-top: 20px;
}

.footer {
    margin-bottom: 20px;
}

.btn-volver {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: var(--font-size-small);
    cursor: pointer;
    padding: 0;
}

    .btn-volver:hover {
        text-decoration: underline;
    }

.user-info {
    position: fixed;
    top: 10px;
    right: 10px;
    font-size: var(--font-size-medium);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------------------------------------------------
   Barra superior de navegación
--------------------------------------------------- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
    padding: 10px 20px;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.left-links,
.right-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

.top-bar a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: var(--font-size-small);
    cursor: pointer;
}

    .top-bar a:hover {
        text-decoration: underline;
    }

/* ---------------------------------------------------
   Layout de Resumen de Tiempos (tarjetas más estrechas)
--------------------------------------------------- */
.time-summary-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

    .time-summary-page .section-title {
        margin: 0 0 0.5rem;
        font-size: 2rem;
        text-align: center;
        color: var(--primary-color);
    }

.row.time-cards {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
}

.card.vertical-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    width: 35%;
    max-width: 100px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    background-color: #f5f5f5;
    margin: 0.25rem 0;
    box-sizing: border-box;
}

    .card.vertical-card img,
    .card.vertical-card .icon-large {
        width: 50px;
        height: 50px;
        margin-bottom: 0.5rem;
        object-fit: contain;
    }

.time-display.large-time {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color);
    text-align: center;
    width: 100%;
}

/* ---------------------------------------------------
   Animaciones de scanner
--------------------------------------------------- */
.scanner-wrapper,
.scanner-success {
    width: min(80vw, 320px);
    aspect-ratio: 1/1;
    position: relative;
    margin: 0 auto;
    box-sizing: border-box;
    overflow: hidden;
}

    .scanner-success img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
    }

/* opcional: pequeña animación de entrada */
.scanner-success {
    animation: fade-in 0.4s ease-out forwards;
    opacity: 0;
}

@keyframes fade-in {
    to {
        opacity: 1;
    }
}


/* --------------------------------------------
   Ajustes para móviles pequeños (≤400px)
-------------------------------------------- */
@media only screen and (max-width: 400px) {
    .section-title {
        font-size: 1.4rem;
        margin-bottom: 0.25rem;
    }

    .row.time-cards {
        gap: 0.25rem;
        margin-bottom: 0.25rem;
    }

    .card.vertical-card {
        width: 45%;
        padding: 0.5rem;
    }

        .card.vertical-card img,
        .card.vertical-card .icon-large {
            width: 30px;
            height: 30px;
            margin-bottom: 0.25rem;
        }

    .time-display.large-time {
        font-size: 1rem;
    }
}

.waiting-image {
    width: 250x;
    height: 280px;    
    display: block;
    margin: 0 auto;
}

.scanner-waiting {
    text-align: center;
    padding: 20px;
}

/* Footer de estado de fichaje */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Paddings fluidos: mínimo 4px, máximo 8px, 1vh en móviles */
    padding: clamp(4px, 1vh, 8px) clamp(12px, 2vw, 20px);
    /* Altura mínima y máxima */
    min-height: 32px; /* que nunca colapse */
    max-height: 6vh; /* que no crezca demasiado en pantallas grandes */

    background: #0B273D;
    color: #fff;
    /* Texto adaptable */
    font-size: clamp(10px, 1.2vw, 12px);
    line-height: 1;
    box-sizing: border-box;
    z-index: 1000;
}

.status-bar .version-inline {
    font-size: clamp(10px, 1vw, 12px);
    margin: 0 4px;
}

.status-bar .status-icon svg {
    /* icono proporcional al viewport */
    width: clamp(16px, 2vw, 24px);
    height: auto;
}
.status-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

    .status-icon svg {
        width: 30px;
        height: 30px;
        fill: #fff;
    }

    .status-icon span {
        margin-top: 2px;
        font-size: 10px;
    }

.version-inline {
    font-size: 12px;
}

.icono-play {
    color: limegreen; /* o cualquier color: #ff0000, rgb(255, 0, 0), etc. */
}