/* ================================================================
   RSVK Check-in App — Mobile-first fullscreen UI
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&display=swap');

/* ---- Reset & Base -------------------------------------------- */

#rsvk-checkin-root *,
#rsvk-checkin-root *::before,
#rsvk-checkin-root *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#rsvk-checkin-root {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #0d1b2e;
    color: #fff;
    overflow: hidden;
    user-select: none;
}

/* ================================================================
   PIN Entry Screen
   ================================================================ */

.rci-pin-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 32px 24px;
    gap: 0;
}

.rci-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 40px;
}

.rci-brand-icon {
    width: 64px;
    height: 64px;
    background: #11457E;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(17,69,126,.5);
}

.rci-brand-icon svg {
    width: 36px;
    height: 36px;
    fill: #fff;
}

.rci-brand-name {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    letter-spacing: .02em;
}

.rci-brand-sub {
    font-size: 13px;
    color: rgba(255,255,255,.5);
    margin-top: 3px;
}

.rci-pin-title {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255,255,255,.7);
    margin-bottom: 20px;
    text-align: center;
}

.rci-pin-dots {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
}

.rci-pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    transition: background .15s, transform .15s;
}

.rci-pin-dot.filled {
    background: #11457E;
    transform: scale(1.1);
}

.rci-pin-dot.error {
    background: #D7141A;
    animation: rci-shake .3s ease;
}

@keyframes rci-shake {
    0%,100% { transform: translateX(0); }
    25%      { transform: translateX(-6px); }
    75%      { transform: translateX(6px); }
}

/* Цифровая клавиатура */
.rci-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 280px;
}

.rci-numpad-btn {
    height: 72px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 14px;
    color: #fff;
    font-family: inherit;
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s, transform .1s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.rci-numpad-btn:active {
    background: rgba(17, 69, 126, .6);
    transform: scale(.95);
}

.rci-numpad-btn.del {
    font-size: 20px;
    color: rgba(255,255,255,.6);
}

.rci-numpad-btn.empty {
    background: transparent;
    border-color: transparent;
    cursor: default;
}

.rci-pin-error {
    margin-top: 16px;
    font-size: 14px;
    color: #f87171;
    text-align: center;
    min-height: 20px;
}

/* ================================================================
   Scanner Screen
   ================================================================ */

.rci-scanner-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Хедер */
.rci-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10;
    flex-shrink: 0;
}

.rci-header-left {
    display: flex;
    flex-direction: column;
}

.rci-header-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.rci-header-count {
    font-size: 12px;
    color: rgba(255,255,255,.55);
    margin-top: 1px;
}

.rci-offline-badge {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(234,179,8,.2);
    border: 1px solid rgba(234,179,8,.4);
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.rci-offline-badge.visible { display: flex; }

/* Область камеры */
.rci-viewfinder {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
}

#rci-camera-element {
    width: 100% !important;
    height: 100% !important;
}

#rci-camera-element video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Прицел */
.rci-aim {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

.rci-aim-box {
    width: min(65vw, 260px);
    height: min(65vw, 260px);
    position: relative;
}

.rci-aim-box::before,
.rci-aim-box::after {
    content: '';
    position: absolute;
    width: 36px;
    height: 36px;
    border-color: #fff;
    border-style: solid;
    opacity: .9;
}

.rci-aim-corner {
    position: absolute;
    width: 36px;
    height: 36px;
    border-color: #fff;
    border-style: solid;
    opacity: .9;
}

.rci-aim-corner:nth-child(1) { top: 0;    left: 0;  border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.rci-aim-corner:nth-child(2) { top: 0;    right: 0; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.rci-aim-corner:nth-child(3) { bottom: 0; left: 0;  border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.rci-aim-corner:nth-child(4) { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }

/* Сканирующая линия */
.rci-scan-line {
    position: absolute;
    left: 6px;
    right: 6px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #11457E, #4fa3e0, #11457E, transparent);
    border-radius: 1px;
    animation: rci-scan 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(17,69,126,.8);
}

@keyframes rci-scan {
    0%   { top: 6px;   opacity: 1; }
    50%  { top: calc(100% - 8px); opacity: 1; }
    100% { top: 6px;   opacity: 1; }
}

/* Подсказка */
.rci-hint {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,.7), transparent);
    text-align: center;
    pointer-events: none;
}

.rci-hint-text {
    font-size: 13px;
    color: rgba(255,255,255,.7);
    margin-bottom: 8px;
}

/* Ручной ввод кода */
.rci-manual {
    padding: 12px 20px 20px;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    flex-shrink: 0;
}

.rci-manual-row {
    display: flex;
    gap: 8px;
}

.rci-manual-input {
    flex: 1;
    padding: 12px 14px;
    background: rgba(255,255,255,.1);
    border: 1.5px solid rgba(255,255,255,.2);
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

.rci-manual-input::placeholder { color: rgba(255,255,255,.35); }
.rci-manual-input:focus { border-color: #4fa3e0; background: rgba(255,255,255,.15); }

.rci-manual-btn {
    padding: 12px 18px;
    background: #11457E;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.rci-manual-btn:active { background: #0d3563; }

/* ================================================================
   Экран результата (overlay)
   ================================================================ */

.rci-result-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: rci-fade-in .22s ease;
}

@keyframes rci-fade-in {
    from { opacity: 0; transform: scale(.96); }
    to   { opacity: 1; transform: scale(1); }
}

.rci-result-overlay.valid    { background: rgba(22, 163, 74, .97); }
.rci-result-overlay.used     { background: rgba(217, 119, 6, .97); }
.rci-result-overlay.invalid  { background: rgba(215, 20, 26, .97); }
.rci-result-overlay.cancelled{ background: rgba(107, 114, 128, .97); }
.rci-result-overlay.pending  { background: rgba(37, 99, 235, .97); }

.rci-result-card {
    text-align: center;
    width: 100%;
    max-width: 360px;
}

.rci-result-icon {
    font-size: 80px;
    line-height: 1;
    display: block;
    margin-bottom: 10px;
}

.rci-result-status {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    margin-bottom: 20px;
    line-height: 1.2;
}

.rci-result-name {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
}

.rci-result-event {
    font-size: 14px;
    opacity: .8;
    margin-bottom: 3px;
}

.rci-result-people {
    font-size: 20px;
    font-weight: 600;
    margin: 14px 0 4px;
    letter-spacing: .01em;
}

.rci-result-note {
    font-size: 12px;
    opacity: .55;
    margin-top: 10px;
}

.rci-result-progress {
    height: 3px;
    background: rgba(255,255,255,.2);
    border-radius: 2px;
    margin-top: 28px;
    overflow: hidden;
}

.rci-result-progress-bar {
    height: 100%;
    background: rgba(255,255,255,.7);
    border-radius: 2px;
    width: 100%;
    transform-origin: left;
    transform: scaleX(1);
}

.rci-result-dismiss {
    display: block;
    margin: 16px auto 0;
    padding: 10px 28px;
    background: rgba(255,255,255,.2);
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 9999px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s;
}

.rci-result-dismiss:active { background: rgba(255,255,255,.35); }
