/* Reloj checador del empleado (html/views/attendance/index.php) */

.att {
    --att-entry: #00ac69;
    --att-entry-soft: #e3f7ef;
    --att-departure: #e81500;
    --att-departure-soft: #fde8e6;
    --att-warning: #f4a100;
    --att-warning-soft: #fff4dc;
    --att-text: #1f2d3d;
    --att-muted: #69707a;
    --att-border: #e3e6ec;
    min-height: 100%;
    padding-bottom: 2rem;
    color: var(--att-text);
}

/* ---------- Encabezado con reloj ---------- */

.att-hero {
    position: relative;
    overflow: hidden;
    padding: 1rem 1rem 5.5rem;
    /* Gris pizarra fijo: el texto blanco siempre contrasta, sin importar el color del cliente */
    background-color: #1e293b;
    background-image: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #fff;
    text-align: center;
}

/* Brillo sutil sobre el fondo */
.att-hero::before {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background:
        radial-gradient(circle at 15% 0%, rgba(255, 255, 255, .22), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(0, 0, 0, .25), transparent 60%);
    pointer-events: none;
}

.att-hero > * {
    position: relative;
}

.att-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.att-back,
.att-back-spacer {
    width: 2.5rem;
    height: 2.5rem;
}

.att-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    transition: background .2s;
}

.att-back:hover,
.att-back:focus {
    background: rgba(255, 255, 255, .28);
    color: #fff;
    text-decoration: none;
}

.att-hero-title {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .85;
}

.att-greeting {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 500;
}

.att-date {
    margin: 0 0 .5rem;
    font-size: .95rem;
    opacity: .8;
    text-transform: capitalize;
}

.att-clock {
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin: .75rem 0 1rem;
}

.att-clock-time {
    font-size: clamp(3.5rem, 18vw, 5.5rem);
    font-weight: 700;
    letter-spacing: -.02em;
}

.att-clock-seconds {
    font-size: clamp(1.25rem, 6vw, 1.75rem);
    font-weight: 500;
    opacity: .7;
    margin-left: .15rem;
}

.att-zone {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    font-size: .75rem;
}

.att-zone-warning {
    background: var(--att-warning);
    color: #1f2d3d;
}

/* ---------- Panel principal ---------- */

.att-panel {
    position: relative;
    max-width: 480px;
    margin: -4rem auto 0;
    padding: 1.5rem 1.25rem;
    background: #fff;
    border-radius: 1.25rem;
    box-shadow: 0 .75rem 2rem rgba(31, 45, 61, .14);
    animation: att-rise .45s ease-out both;
}

@media (max-width: 520px) {
    .att-panel {
        margin-left: .75rem;
        margin-right: .75rem;
    }
}

.att-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    padding: 2.5rem 0;
    color: var(--att-muted);
}

/* Estado de la jornada */
.att-status {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .9rem 1rem;
    border-radius: .9rem;
}

.att-status strong,
.att-status small {
    display: block;
}

.att-status small {
    color: var(--att-muted);
    margin-top: .1rem;
}

.att-status-idle {
    background: #f2f4f8;
}

.att-status-working {
    background: var(--att-entry-soft);
}

.att-status-dot {
    flex: none;
    width: .7rem;
    height: .7rem;
    margin-top: .35rem;
    border-radius: 50%;
    background: #a7aeb8;
}

.att-status-working .att-status-dot {
    background: var(--att-entry);
    box-shadow: 0 0 0 0 rgba(0, 172, 105, .6);
    animation: att-dot 1.8s infinite;
}

/* Boton circular */
.att-action-wrap {
    display: flex;
    justify-content: center;
    padding: 1.75rem 0;
}

.att-action {
    --att-color: var(--att-entry);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    width: 11rem;
    height: 11rem;
    border: 0;
    border-radius: 50%;
    background: var(--att-color);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 .75rem 1.5rem rgba(31, 45, 61, .2);
    transition: transform .15s ease, box-shadow .2s ease, filter .2s ease, opacity .2s;
    -webkit-tap-highlight-color: transparent;
}

.att-action-entry {
    --att-color: var(--att-entry);
}

.att-action-departure {
    --att-color: var(--att-departure);
}

.att-action::after {
    content: "";
    position: absolute;
    top: -10px; right: -10px; bottom: -10px; left: -10px;
    border-radius: 50%;
    border: 3px solid var(--att-color);
    opacity: 0;
}

.att-action-ready::after {
    animation: att-pulse 2s ease-out infinite;
}

.att-action:not(:disabled):hover {
    filter: brightness(1.06);
}

.att-action:not(:disabled):active {
    transform: scale(.95);
}

.att-action:focus {
    outline: none;
}

.att-action:focus-visible {
    box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--att-color);
}

.att-action:disabled {
    opacity: .45;
    filter: grayscale(.4);
    box-shadow: none;
    cursor: not-allowed;
}

.att-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 2.5rem;
    font-size: 2.25rem;
}

.att-action-label {
    max-width: 8rem;
    line-height: 1.2;
}

/* Ubicacion */
.att-location {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    border: 1px solid var(--att-border);
    border-radius: .9rem;
}

.att-location-icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: #f2f4f8;
    color: var(--att-muted);
}

.att-location-ready .att-location-icon {
    background: var(--att-entry-soft);
    color: var(--att-entry);
}

.att-location-error {
    border-color: var(--att-departure);
    background: var(--att-departure-soft);
}

.att-location-error .att-location-icon {
    background: #fff;
    color: var(--att-departure);
}

.att-location-text {
    flex: 1;
    min-width: 0;
}

.att-location-text strong,
.att-location-text small {
    display: block;
}

.att-location-text small {
    color: var(--att-muted);
}

.att-location-retry {
    flex: none;
}

/* Linea de tiempo del dia */
.att-timeline {
    display: flex;
    align-items: center;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--att-border);
}

.att-timeline-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    min-width: 5.5rem;
    opacity: .5;
}

.att-timeline-done {
    opacity: 1;
}

.att-timeline-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: #f2f4f8;
    color: var(--att-muted);
}

.att-timeline-done .att-timeline-entry {
    background: var(--att-entry-soft);
    color: var(--att-entry);
}

.att-timeline-done .att-timeline-departure {
    background: var(--att-departure-soft);
    color: var(--att-departure);
}

.att-timeline-label {
    font-size: .75rem;
    color: var(--att-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.att-timeline-time {
    font-size: 1.15rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.att-timeline-line {
    flex: 1;
    height: 2px;
    margin: 0 .5rem 2.4rem;
    background: var(--att-border);
}

/* Spinner */
.att-spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(105, 112, 122, .3);
    border-top-color: var(--att-muted);
    border-radius: 50%;
    animation: att-spin .8s linear infinite;
}

.att-spinner-light {
    width: 2rem;
    height: 2rem;
    border-width: 3px;
    border-color: rgba(255, 255, 255, .35);
    border-top-color: #fff;
}

/* ---------- Confirmacion ---------- */

.att-success {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(17, 24, 39, .55);
    animation: att-fade .2s ease-out both;
}

.att-success-card {
    width: 100%;
    max-width: 360px;
    padding: 2rem 1.5rem 1.5rem;
    border-radius: 1.25rem;
    background: #fff;
    text-align: center;
    animation: att-pop .35s cubic-bezier(.2, 1.4, .4, 1) both;
}

.att-success-card h2 {
    margin: 1rem 0 .25rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--att-text);
}

.att-success-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    color: #fff;
    font-size: 2.25rem;
    animation: att-pop .45s .1s cubic-bezier(.2, 1.4, .4, 1) both;
}

.att-success-entry {
    background: var(--att-entry);
}

.att-success-departure {
    background: var(--att-departure);
}

.att-success-time {
    margin-bottom: .5rem;
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ---------- Animaciones ---------- */

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

@keyframes att-pulse {
    0% { transform: scale(.92); opacity: .7; }
    100% { transform: scale(1.18); opacity: 0; }
}

@keyframes att-dot {
    0% { box-shadow: 0 0 0 0 rgba(0, 172, 105, .55); }
    70% { box-shadow: 0 0 0 .5rem rgba(0, 172, 105, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 172, 105, 0); }
}

@keyframes att-rise {
    from { opacity: 0; transform: translateY(1rem); }
    to { opacity: 1; transform: none; }
}

@keyframes att-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes att-pop {
    from { opacity: 0; transform: scale(.7); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .att *,
    .att *::before,
    .att *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
