:root {
    --bg-dark: #f1f2f6;
    --card-bg: #ffffff;
    --primary: #ff4757;
    --primary-glow: rgba(255, 71, 87, 0.2);
    --success: #25d366;
    --error: #e0404e;
    --text-main: #2f3542;
    --text-muted: #747d8c;
    --glass: rgba(255, 255, 255, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Animated Background Elements */
.bg-blobs {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    filter: blur(80px);
    opacity: 0.3;
}

.blob {
    position: absolute;
    border-radius: 50%;
    background: var(--primary);
    animation: move 20s infinite alternate;
}

.blob-1 { width: 400px; height: 400px; top: -100px; left: -100px; background: var(--primary); }
.blob-2 { width: 350px; height: 350px; bottom: -50px; right: -50px; background: #0088cc; animation-delay: -5s; }

@keyframes move {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(100px, 100px) scale(1.2); }
}

.totem-container {
    width: 100%;
    max-width: 800px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass);
    border-radius: 24px;
    padding: 3.5rem;
    box-shadow: 0 20px 40px rgba(47, 53, 66, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    display: block;
}

.header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), #0088cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.camera-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 4 / 3;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 0 40px var(--primary-glow);
    border: 2px solid var(--primary);
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
}

/* Scanner Animation */
.scanner-laser {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    box-shadow: 0 0 20px 5px var(--primary-glow);
    animation: scan 3s ease-in-out infinite alternate;
    z-index: 10;
}

@keyframes scan {
    0% { top: 0%; }
    100% { top: 100%; }
}

.status-panel {
    margin-top: 2rem;
    text-align: center;
    padding: 1.5rem;
    border-radius: 15px;
    width: 100%;
    background: var(--glass);
    border: 1px solid rgba(47, 53, 66, 0.1);
    transition: all 0.3s ease;
}

.status-panel.success {
    background: rgba(46, 213, 115, 0.15);
    border: 1px solid var(--success);
    box-shadow: 0 0 20px rgba(46, 213, 115, 0.2);
}
.status-panel.success .status-icon { color: var(--success); }

.status-panel.error {
    background: rgba(255, 71, 87, 0.15);
    border: 1px solid var(--error);
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.2);
}
.status-panel.error .status-icon { color: var(--error); }

.status-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.mock-panel {
    margin-top: 2.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.mock-panel p {
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn {
    background: var(--glass);
    color: var(--text-main);
    border: 1px solid rgba(47, 53, 66, 0.1);
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.btn i {
    margin-right: 5px;
}

.btn-db {
    border-color: rgba(0, 136, 204, 0.3);
}
.btn-db:hover {
    background: #0088cc !important;
    border-color: #0088cc !important;
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

.btn-success {
    border-color: rgba(46, 213, 115, 0.3);
}
.btn-success:hover {
    background: var(--success) !important;
    border-color: var(--success) !important;
    box-shadow: 0 4px 12px rgba(46, 213, 115, 0.3);
}

.btn-danger {
    border-color: rgba(255, 71, 87, 0.3);
}
.btn-danger:hover {
    background: var(--error) !important;
    border-color: var(--error) !important;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

/* Config Styles */
.config-trigger {
    position: absolute;
    top: 25px;
    right: 30px;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
    z-index: 100;
}

.config-trigger:hover {
    color: var(--primary);
    transform: rotate(90deg);
}

.config-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.config-modal.open {
    display: flex;
}

.config-content {
    background: var(--card-bg);
    border: 1px solid rgba(47, 53, 66, 0.1);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(47, 53, 66, 0.15);
}

.config-content h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

/* Status Panel Text */
.status-panel h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.status-panel p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .totem-container {
        padding: 1.5rem;
        border-radius: 16px;
        margin: 1rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .mock-panel {
        flex-direction: column;
    }

    .config-trigger {
        top: 15px;
        right: 20px;
    }
    
    .user-totem-info {
        top: 15px;
        left: 20px;
        font-size: 0.75rem;
    }
}

/* User Info styles */
.user-totem-info {
    position: absolute;
    top: 25px;
    left: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
    font-size: 0.85rem;
}

.user-name {
    font-weight: 600;
    color: var(--text-main);
}

.badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.badge.root {
    background: #2d3436;
    color: #dfe6e9;
    border: 1px solid #f1c40f;
    box-shadow: 0 0 5px rgba(241, 196, 15, 0.3);
}

.badge.admin {
    background: rgba(255, 71, 87, 0.15);
    color: #ff4757;
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.badge.recepcao {
    background: rgba(155, 89, 182, 0.15);
    color: #9b59b6;
    border: 1px solid rgba(155, 89, 182, 0.3);
}

.btn-logout-totem {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.05rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.btn-logout-totem:hover {
    color: var(--primary);
    transform: scale(1.15);
}
