/*
 * Student photo capture widget.
 *
 * Plain CSS, registered through FilamentAsset, rather than Tailwind utilities.
 * The panel ships a PRE-COMPILED stylesheet containing only the classes
 * Filament itself uses, so arbitrary utilities written in a custom Blade view
 * silently do nothing — which is how the capture panel ended up full-width with
 * its buttons pushed below the fold, and a raw "Choose File" input on show.
 *
 * Everything here is namespaced under .apc- so it cannot collide with Filament.
 */

.apc-root {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ------------------------------------------------------------- summary row */

.apc-summary {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.apc-preview {
    position: relative;
    flex: 0 0 auto;
    width: 6rem;
    height: 8rem;
    overflow: hidden;
    border-radius: 0.5rem;
    border: 1px solid rgb(212 212 216);
    background: rgb(250 250 250);
    display: flex;
    align-items: center;
    justify-content: center;
}

.apc-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.apc-preview-empty {
    font-size: 0.7rem;
    color: rgb(161 161 170);
    text-align: center;
    padding: 0 0.5rem;
    line-height: 1.4;
}

.apc-actions {
    flex: 1 1 16rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.apc-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ------------------------------------------------------------------ hints */

.apc-hints {
    margin: 0;
    padding-inline-start: 1.1rem;
    font-size: 0.75rem;
    line-height: 1.6;
    color: rgb(113 113 122);
}

.apc-hidden {
    display: none !important;
}

/* ----------------------------------------------------------------- alerts */

.apc-alert {
    display: flex;
    gap: 0.5rem;
    border-radius: 0.5rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.8rem;
    line-height: 1.5;
}

.apc-alert-error {
    background: rgb(254 242 242);
    color: rgb(153 27 27);
    border: 1px solid rgb(254 202 202);
}

.apc-alert-warning {
    background: rgb(254 252 232);
    color: rgb(133 77 14);
    border: 1px solid rgb(254 240 138);
}

.apc-alert-note {
    margin-top: 0.25rem;
    opacity: 0.85;
    font-size: 0.72rem;
}

/* ----------------------------------------------------------- camera panel */

.apc-camera {
    border: 1px solid rgb(212 212 216);
    border-radius: 0.6rem;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    /* Keeps the whole panel — preview AND buttons — inside one screen, which
       is the entire point: the capture button must never need scrolling. */
    max-width: 22rem;
}

.apc-select-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: rgb(82 82 91);
}

.apc-select {
    width: 100%;
    font-size: 0.8rem;
    padding: 0.35rem 0.5rem;
    border-radius: 0.45rem;
    border: 1px solid rgb(212 212 216);
    background: #fff;
    color: inherit;
}

.apc-stage {
    position: relative;
    width: 100%;
    /* 3:4 portrait, matching the enrolment image the device receives. */
    aspect-ratio: 3 / 4;
    max-height: 17rem;
    margin-inline: auto;
    overflow: hidden;
    border-radius: 0.5rem;
    background: #000;
}

.apc-stage video,
.apc-stage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Oval framing guide for face enrolment. */
.apc-guide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.apc-guide span {
    width: 52%;
    height: 62%;
    border: 2px dashed rgba(255, 255, 255, 0.72);
    border-radius: 50%;
}

.apc-busy {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.8rem;
}

.apc-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}

/* --------------------------------------------------------------- dark mode */

.dark .apc-preview {
    border-color: rgb(63 63 70);
    background: rgb(39 39 42);
}

.dark .apc-camera {
    border-color: rgb(63 63 70);
}

.dark .apc-select {
    background: rgb(39 39 42);
    border-color: rgb(63 63 70);
}

.dark .apc-select-label {
    color: rgb(212 212 216);
}

.dark .apc-hints {
    color: rgb(161 161 170);
}

.dark .apc-alert-error {
    background: rgba(127, 29, 29, 0.25);
    color: rgb(252 165 165);
    border-color: rgba(153, 27, 27, 0.5);
}

.dark .apc-alert-warning {
    background: rgba(113, 63, 18, 0.25);
    color: rgb(253 224 71);
    border-color: rgba(133, 77, 14, 0.5);
}

/* ------------------------------------------------------------------ phones */

@media (max-width: 640px) {
    .apc-camera {
        max-width: 100%;
    }

    .apc-stage {
        max-height: 14rem;
    }

    .apc-controls {
        justify-content: stretch;
    }
}
