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

body {
    font-family: 'Arial', sans-serif;
    background: #ffe209;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2rem;
    color: #333;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    text-align: center;
    max-width: 800px;
    width: 90%;
    position: relative;
}

.header-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}

.logout-btn {
    background: #ff0078;
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background: #d6006a;
}

/* Settings Modal Enhanced */
.settings-modal-content {
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
}

.settings-modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

/* Tabs */
.settings-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: #f8f9fa;
    color: #333;
}

.tab-btn.active {
    color: #ff0078;
    border-bottom-color: #ff0078;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Photos List */
.photos-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f8f9fa;
}

.photo-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.photo-item:hover {
    background: #e9ecef;
}

.photo-item:last-child {
    border-bottom: none;
}

.photo-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 12px;
    border: 2px solid #ddd;
}

.photo-info {
    flex: 1;
}

.photo-info h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #333;
}

.photo-info p {
    margin: 0;
    font-size: 12px;
    color: #666;
}

.photo-actions {
    display: flex;
    gap: 8px;
}

.photo-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    text-decoration: none;
    color: white;
}

.photo-btn.recall {
    background: #28a745;
}

.photo-btn.recall:hover {
    background: #218838;
}

.photo-btn.download {
    background: #007bff;
}

.photo-btn.download:hover {
    background: #0056b3;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.btn-logout {
    background: #dc3545;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    font-weight: bold;
    transition: background-color 0.3s;
}

.btn-logout:hover {
    background: #c82333;
    color: white;
}

/* Print Button */
.btn-print {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.btn-print:hover {
    background: #138496;
    transform: translateY(-2px);
}

.btn-print:active {
    transform: translateY(0);
}

/* Print Settings */
.setting-group input[type="number"] {
    width: 80px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.setting-group input[type="checkbox"] {
    margin-right: 8px;
}

/* Print status messages */
.print-status {
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
}

.print-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.print-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.print-status.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Certificate Upload */
.certificate-upload {
    margin-top: 5px;
}

.cert-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cert-buttons .btn {
    flex: 1;
    min-width: 150px;
}

.certificate-status {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: bold;
}

.certificate-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.certificate-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.certificate-status.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.certificate-status.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Settings HR separator */
.settings-modal-body hr {
    margin: 20px 0;
    border: none;
    border-top: 1px solid #eee;
}

/* Security Options */
.security-options {
    margin: 10px 0;
}

.radio-option {
    display: block;
    margin: 8px 0;
    cursor: pointer;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.radio-option:hover {
    border-color: #ff0078;
    background: #f8f9fa;
}

.radio-option input[type="radio"] {
    margin-right: 8px;
}

.radio-option input[type="radio"]:checked + span {
    font-weight: bold;
    color: #ff0078;
}

.radio-option:has(input[type="radio"]:checked) {
    border-color: #ff0078;
    background: #fff5f8;
}

h1 {
    color: #ff0078;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.camera-container {
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    margin: 2rem auto;
    max-width: 640px;
    position: relative;
}

#video {
    width: 100%;
    height: auto;
    display: block;
}

.controls {
    margin: 2rem 0;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #333;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-settings {
    background: linear-gradient(45deg, #6c757d, #495057);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
}

.btn-settings:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.6);
}

.status {
    font-size: 1.1rem;
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    font-weight: bold;
}

.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status.processing {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.result {
    margin-top: 2rem;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 15px;
}

.result h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

#compositeImage {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        margin: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
}

/* Animation for loading states */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.btn:disabled {
    animation: pulse 1.5s infinite;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { 
        opacity: 0; 
        transform: translateY(-50px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.close {
    color: white;
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}

.close:hover {
    opacity: 1;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1rem 2rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.camera-info {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 0.9rem;
    color: #666;
}

.captured-photo {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 15px;
    text-align: center;
}

.captured-photo h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.captured-photo img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Settings corner button */
.settings-corner {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.2rem;
    padding: 0;
    z-index: 100;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.settings-corner:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Countdown */
.countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    background: rgba(0,0,0,0.8);
    border-radius: 50%;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.countdown-number {
    font-size: 6rem;
    font-weight: bold;
    color: #ffe209;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Loading Container */
.progress-container {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 15px;
    margin: 2rem 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.progress-text h3 {
    color: #ff0078;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.progress-text p {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 2rem;
    font-weight: 500;
    min-height: 1.5rem;
    transition: all 0.5s ease;
}

/* Indeterminate Loading Bar */
.loading-bar-container {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.loading-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff0078, #ffe209, #ff0078);
    border-radius: 4px;
    width: 50%;
    position: relative;
    animation: loadingSlide 2s ease-in-out infinite;
}

@keyframes loadingSlide {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

@keyframes loadingPulse {
    0%, 100% {
        opacity: 0.3;
        transform: translateY(-50%) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1.2);
    }
}

/* Photo Results */
.photo-results {
    display: flex;
    gap: 2rem;
    margin: 2rem 0;
    justify-content: center;
    flex-wrap: wrap;
}

.photo-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    max-width: 400px;
    flex: 1;
    min-width: 300px;
}

.photo-section h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.photo-section img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.photo-section img:hover {
    transform: scale(1.05);
}

/* QR Code Container */
.qr-container {
    background: #f8f9fa;
    border: 3px solid #ffe209;
    border-radius: 20px;
    padding: 2rem;
    margin: 2rem 0;
    text-align: center;
    box-shadow: 0 10px 30px rgba(255, 226, 9, 0.2);
}

.qr-container h3 {
    color: #ff0078;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.qr-code {
    background: white;
    border: 5px solid white;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    max-width: 200px;
    width: 100%;
    height: auto;
    margin: 1rem auto;
    display: block;
}

.qr-instructions {
    color: #333;
    font-size: 1.1rem;
    font-weight: 500;
    margin-top: 1rem;
    line-height: 1.4;
}

/* Quiz Styles */
.quiz-container {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

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

.quiz-header h2 {
    color: #ff0078;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.quiz-header p {
    color: #666;
    font-size: 1.1rem;
}

.quiz-progress {
    margin-top: 1.5rem;
}

.quiz-progress span {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #333;
}

.quiz-progress-bar {
    width: 100%;
    height: 10px;
    background: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffe209, #ff0078);
    transition: width 0.5s ease;
    border-radius: 5px;
}

.quiz-content {
    max-width: 600px;
    margin: 0 auto;
}

.quiz-question {
    color: #333;
    font-size: 1.4rem;
    margin-bottom: 2rem;
    text-align: center;
    min-height: 3rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quiz-option {
    padding: 1.2rem;
    background: #f8f9fa;
    border: 3px solid transparent;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    text-align: center;
    font-weight: 500;
}

.quiz-option:hover {
    background: #ffe209;
    border-color: #ff0078;
    transform: translateY(-2px);
}

.quiz-option.selected {
    background: #ffe209;
    border-color: #ff0078;
}

.quiz-option.correct {
    background: #d4edda;
    border-color: #28a745;
    cursor: default;
}

.quiz-option.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
    cursor: default;
}

.quiz-option.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.quiz-feedback {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 15px;
    text-align: center;
}

.quiz-feedback p {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.quiz-results {
    text-align: center;
    padding: 2rem;
}

.quiz-results h3 {
    color: #ff0078;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.quiz-results p {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 1rem;
}

.quiz-wait-message {
    color: #666;
    font-style: italic;
    margin-top: 2rem;
}

/* Loading dots animation */
.loading-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: #ff0078;
    border-radius: 50%;
    animation: dotPulse 1.5s infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.3s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes dotPulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@media (max-width: 768px) {
    .photo-results {
        flex-direction: column;
        align-items: center;
    }
    
    .photo-section {
        max-width: 100%;
    }
    
    .qr-container {
        margin: 1.5rem 0;
        padding: 1.5rem;
    }
    
    .qr-code {
        max-width: 180px;
    }
    
    .quiz-container {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .quiz-question {
        font-size: 1.2rem;
    }
    
    .quiz-option {
        padding: 1rem;
        font-size: 1rem;
    }
}