/* ==========================================================================
   BRE Sign Terminal — Tablet UI
   Apple-Style | Fullscreen Kiosk | Touch-optimiert
   ========================================================================== */

/* ====== WRAP ====== */
.bre-terminal-wrap {
    position: relative;
    width: 100%;
    min-height: 100svh;
    background: #f8fafc;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* ====== SCREENS ====== */
.bre-terminal-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.97);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.bre-terminal-screen.bre-terminal-active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

/* ====== IDLE SCREEN ====== */
.bre-terminal-idle-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px;
    text-align: center;
    max-width: 480px;
}

.bre-terminal-logo img {
    max-height: 60px;
    width: auto;
}

.bre-terminal-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.bre-terminal-idle-icon {
    width: 100px;
    height: 100px;
    color: #94a3b8;
}

.bre-pulse-ring {
    animation: bre-pulse-ring 2.5s ease-out infinite;
    transform-origin: center;
}

@keyframes bre-pulse-ring {
    0%   { transform: scale(0.85); opacity: 0.15; }
    50%  { transform: scale(1.05); opacity: 0.25; }
    100% { transform: scale(0.85); opacity: 0.15; }
}

.bre-terminal-idle-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.bre-terminal-idle-sub {
    font-size: 0.9375rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* Warteanimation Punkte */
.bre-terminal-dots {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.bre-terminal-dots span {
    width: 8px;
    height: 8px;
    background: #cbd5e1;
    border-radius: 50%;
    animation: bre-dot-bounce 1.4s ease-in-out infinite;
}
.bre-terminal-dots span:nth-child(1) { animation-delay: 0s; }
.bre-terminal-dots span:nth-child(2) { animation-delay: 0.2s; }
.bre-terminal-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bre-dot-bounce {
    0%, 80%, 100% { transform: scale(1);   opacity: 0.4; }
    40%           { transform: scale(1.4); opacity: 1; }
}

/* ====== SIGN SCREEN ====== */
#bre-terminal-sign {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    gap: 0;
    height: 100%;
    max-height: 100svh;
    overflow: hidden;
}

.bre-terminal-sign-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.bre-terminal-sign-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.bre-terminal-sign-customer {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

.bre-terminal-sign-bikes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.bre-terminal-bike-tag {
    background: #f1f5f9;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
}

.bre-terminal-sign-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #22c55e;
    background: #f0fdf4;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid #bbf7d0;
    flex-shrink: 0;
}

/* Canvas */
.bre-terminal-canvas-wrap {
    flex: none;
    display: flex;
    flex-direction: column;
    padding: 24px 28px 12px;
    position: relative;
}

.bre-terminal-canvas-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}

#bre-signature-canvas {
    width: 100%;
    flex: none;
    height: 240px;
    max-height: 38vh;
    min-height: 170px;
    background: #fff;
    border: 2px dashed #cbd5e1;
    border-radius: 20px;
    cursor: crosshair;
    touch-action: none;
    display: block;
    transition: border-color 0.2s ease;
}

#bre-signature-canvas:active {
    border-color: #1e293b;
    border-style: solid;
}

.bre-terminal-canvas-line {
    position: absolute;
    bottom: 52px;
    left: 56px;
    right: 56px;
    height: 2px;
    background: #94a3b8;
    pointer-events: none;
}
/* "✗"-Marker am Zeilenanfang — wie auf einem echten Unterschriftsformular. */
.bre-terminal-canvas-line::before {
    content: "\00D7";
    position: absolute;
    left: -22px;
    top: -13px;
    font-size: 20px;
    font-weight: 700;
    color: #94a3b8;
    line-height: 1;
}

/* Footer — sticky am unteren Rand, immer sichtbar */
.bre-terminal-sign-footer {
    display: flex;
    gap: 12px;
    padding: 16px 28px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.04);
}
.bre-terminal-sign-footer .bre-terminal-btn { flex: 1; min-height: 56px; font-size: 1rem; font-weight: 700; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; border: 0; }
.bre-terminal-sign-footer .bre-terminal-btn-secondary { background: #f1f5f9; color: #475569; }
.bre-terminal-sign-footer .bre-terminal-btn-primary { background: #16a34a; color: #fff; }
.bre-terminal-sign-footer .bre-terminal-btn-primary[disabled] { background: #cbd5e1; cursor: not-allowed; opacity: 0.6; }

.bre-terminal-legal {
    text-align: center;
    font-size: 0.6875rem;
    color: #94a3b8;
    padding: 0 28px 16px;
    margin: 0;
    background: #fff;
    flex-shrink: 0;
}

.bre-terminal-legal a {
    color: #64748b;
}

/* ====== BUTTONS ====== */
.bre-terminal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 56px;         /* großes Touch-Target */
    padding: 0 28px;
    border-radius: 14px;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
    font-family: inherit;
}

.bre-terminal-btn:active { transform: scale(0.97); }

.bre-terminal-btn-primary {
    flex: 2;
    background: #1e293b;
    color: #fff;
}

.bre-terminal-btn-primary:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

.bre-terminal-btn-secondary {
    flex: 1;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* ====== SUCCESS SCREEN ====== */
.bre-terminal-success-inner,
.bre-terminal-error-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 48px 40px;
    text-align: center;
    max-width: 480px;
}

.bre-terminal-success-icon,
.bre-terminal-error-icon {
    width: 100px;
    height: 100px;
}

.bre-terminal-success-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.bre-terminal-success-sub {
    font-size: 1rem;
    color: #64748b;
    margin: 0;
}

.bre-terminal-success-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: #22c55e;
    margin: 0;
}

/* ====== TERMINAL-ID BADGE (oben rechts) ====== */
.bre-terminal-id-display {
    position: fixed;
    top: 12px;
    right: 16px;
    font-size: 0.625rem;
    color: #cbd5e1;
    font-weight: 600;
    z-index: 100;
    pointer-events: none;
}

/* ====== SPINNER ====== */
@keyframes bre-spin {
    to { transform: rotate(360deg); }
}
.bre-spin {
    animation: bre-spin 0.8s linear infinite;
}

/* ====== DASHBOARD: PC-seitige Buttons & Toast ====== */
.bre-sign-terminal-btn {
    background: #1e293b;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    transition: background 0.15s ease;
}
.bre-sign-terminal-btn:hover { background: #0f172a; }
.bre-sign-terminal-btn.bre-sign-waiting { background: #f59e0b; color: #fff; }
.bre-sign-terminal-btn.bre-sign-done    { background: #22c55e; color: #fff; cursor: default; }

.bre-sign-terminal-cancel {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    padding: 6px;
    text-decoration: underline;
    font-weight: 600;
}

#bre-sign-status-badge {
    display: none;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    margin-left: 10px;
}
.bre-badge-pending { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.bre-badge-signed  { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* Toast */
.bre-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    z-index: 99999;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.bre-toast-visible { opacity: 1; transform: translateY(0); }
.bre-toast-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.bre-toast-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ====== PIN SCREEN ====== */
.bre-terminal-pin-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 32px 48px;
    text-align: center;
    max-width: 380px;
    width: 100%;
}

.bre-terminal-pin-icon {
    width: 80px;
    height: 80px;
}

.bre-terminal-pin-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
}

.bre-terminal-pin-sub {
    font-size: 0.9375rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

.bre-terminal-pin-error {
    font-size: 0.875rem;
    font-weight: 600;
    color: #dc2626;
    min-height: 1.25rem;
    margin: 0;
}

/* PIN Punkte */
.bre-pin-dots {
    display: flex;
    gap: 20px;
    margin: 8px 0;
}

.bre-pin-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2.5px solid #cbd5e1;
    background: transparent;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.bre-pin-dot.filled {
    background: #1e293b;
    border-color: #1e293b;
    transform: scale(1.1);
}

/* Numpad */
.bre-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 300px;
    margin-top: 4px;
}

.bre-numpad-btn {
    height: 70px;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s ease, transform 0.1s ease, border-color 0.12s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.bre-numpad-btn:active {
    background: #f1f5f9;
    border-color: #94a3b8;
    transform: scale(0.95);
}

.bre-numpad-btn:disabled {
    opacity: 0.4;
    pointer-events: none;
}

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

.bre-numpad-btn-del {
    color: #64748b;
    font-size: 1rem;
}

/* ====== MOBILE / LANDSCAPE ====== */
@media (max-height: 600px) and (orientation: landscape) {
    .bre-terminal-sign-header { padding: 12px 20px; }
    .bre-terminal-canvas-wrap { padding: 12px 20px 8px; }
    .bre-terminal-sign-footer  { padding: 10px 20px; }
    .bre-terminal-btn { min-height: 48px; font-size: 0.875rem; }
    .bre-terminal-legal { padding: 8px 20px 12px; }
    .bre-numpad-btn { height: 52px; }
    .bre-terminal-pin-inner { padding: 20px 32px 24px; gap: 10px; }
}
