:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 12px;
    --box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #232526 0%, #414345 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    color: var(--dark-color);
    padding-bottom: 2rem;
    position: relative;
}

.container {
    max-width: 800px;
    padding: 0 15px;
}

/* Security-focused Card Design */
.main-content {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
    border: none;
    position: relative;
    background-color: white;
    padding: 2rem;
    width: 100%;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

h1 {
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

h2 {
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-content {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Settings Button (Cog) */
.settings-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: all 0.2s ease;
}

.settings-btn:hover {
    transform: rotate(30deg);
    background: #0b5ed7;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* User List Section */
.user-list-section {
    margin-bottom: 2rem;
}

.face-list-container {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    padding: 0.5rem;
}

.face-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin: 6px 0;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.face-item:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.face-item span {
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
}

.face-item span::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--success-color);
    border-radius: 50%;
    margin-right: 8px;
}

.face-item button {
    margin-left: 12px;
}

/* Recognition Section */
.recognition-section {
    margin-top: 2rem;
}

.canvas-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    background-color: #222;
    aspect-ratio: 4/3;  /* Mantém proporção consistente */
    min-height: 360px;  /* Altura mínima da área da câmera */
}

#video {
    display: none;
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #222;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    object-fit: cover;
}

.security-status {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.security-indicator {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.security-indicator i {
    color: var(--success-color);
}

/* Recognition Message */
#recognitionMessage {
    font-size: 1.1em;
    font-weight: 500;
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
    display: none; /* Inicialmente oculto */
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.recognized {
    background-color: rgba(25, 135, 84, 0.15);
    color: var(--success-color);
    border: none;
}

.not-recognized {
    background-color: rgba(220, 53, 69, 0.15);
    color: var(--danger-color);
    border: none;
}

/* Face recognition indicator (directly on face) */
.face-status-indicator {
    position: absolute;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 100;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    transform: translateX(-50%);
    left: 50%;
}

.face-status-recognized {
    background-color: #198754;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border: none;
}

.face-status-unknown {
    background-color: #dc3545;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border: none;
}

.status {
    padding: 10px;
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 8px;
    text-align: center;
}

.system-status {
    position: fixed;
    top: 10px;
    left: 10px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 6px;
    z-index: 1000;
    font-weight: 500;
}

/* Button Styles */
.btn {
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.btn-primary, .btn-success, .btn-danger, .btn-secondary {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Modal Styles */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--box-shadow);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--light-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--light-color);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* User Registration Form */
#multiUserForm .user-input-row {
    background-color: rgba(0, 0, 0, 0.02);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Loading Overlay */
#loadingOverlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}

#loadingOverlay.active {
    display: flex;
}

#loadingOverlay .spinner-border {
    width: 3.5rem;
    height: 3.5rem;
    border-width: 0.35rem;
    color: white;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
        max-width: 100%;
    }
    
    .main-content {
        padding: 1.25rem !important;
    }
    
    #recognitionMessage {
        font-size: 1rem;
    }
    
    .face-item {
        padding: 8px 10px;
    }
    
    .btn {
        padding: 6px 12px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.4rem;
    }
    
    .settings-btn {
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 576px) {    
    h1 {
        font-size: 1.5rem;
    }
    
    .face-item {
        flex-direction: column;
    }
    
    .face-item button {
        margin-left: 0;
        margin-top: 6px;
        width: 100%;
    }
    
    .security-indicator {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .settings-btn {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
    
    #canvas {
        max-height: calc(100vh - 240px);
    }
}