/* Reset và Base Styles */

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

:root {
    --primary-color: #FFD700;
    --secondary-color: #FFA500;
    --dark-bg: #0a0a0a;
    --darker-bg: #000000;
    --text-light: #ffffff;
    --text-gray: #cccccc;
    --gradient-primary: linear-gradient(135deg, #FFD700, #FFA500);
    --gradient-secondary: linear-gradient(135deg, #FFA500, #FF8C00);
    --shadow-glow: 0 0 20px rgba(255, 215, 0, 0.3);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Open Sans', sans-serif;
    background: var(--dark-bg);
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}


/* Typography */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* Navigation */

.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Open Sans', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-logo i {
    font-size: 2rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.nav-menu a:hover::after {
    width: 100%;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--primary-color);
    margin: 3px 0;
    transition: 0.3s;
}


/* Hero Section */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23FFD700" stroke-width="0.5" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--text-gray);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--darker-bg);
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--darker-bg);
    transform: translateY(-2px);
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.ai-brain {
    font-size: 15rem;
    color: var(--primary-color);
    animation: pulse 2s infinite;
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.5));
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}


/* Theory Section */

.theory {
    padding: 100px 0;
    background: var(--dark-bg);
}

.theory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.theory-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.theory-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-card);
}

.card-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.theory-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.theory-card p {
    color: var(--text-gray);
    line-height: 1.6;
}


/* YOLO Analysis Section */

.yolo-analysis {
    padding: 100px 0;
    background: linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
}

.yolo-timeline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.timeline-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.timeline-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.timeline-item:hover::before {
    transform: scaleX(1);
}

.timeline-item:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-card);
}

.timeline-item h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.timeline-item p {
    color: var(--text-gray);
    line-height: 1.6;
}


/* Process Section */

.process {
    padding: 100px 0;
    background: var(--dark-bg);
}

.process-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.step {
    text-align: center;
    position: relative;
}

.step-number {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--darker-bg);
    margin: 0 auto 1rem;
    box-shadow: var(--shadow-glow);
}

.step h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.step p {
    color: var(--text-gray);
    line-height: 1.6;
}


/* Results Section */

.results {
    padding: 100px 0;
    background: linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.metric-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-card);
}

.metric-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-family: 'Open Sans', sans-serif;
}

.metric-label {
    font-size: 1.2rem;
    color: var(--text-gray);
    font-weight: 500;
}

.demo-section {
    text-align: center;
}

.demo-section h3 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 2rem;
}

.video-container {
    max-width: 800px;
    margin: 0 auto;
}

.video-placeholder {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 215, 0, 0.3);
    border-radius: 15px;
    padding: 4rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.video-placeholder:hover {
    border-color: var(--primary-color);
    background: rgba(255, 215, 0, 0.05);
}

.video-placeholder i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.video-placeholder p {
    font-size: 1.2rem;
    color: var(--text-gray);
}


/* Contact Section */

.contact {
    padding: 100px 0;
    background: var(--dark-bg);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    margin-top: 3rem;
}

.contact-info h3,
.references h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    color: var(--text-gray);
}

.contact-item i {
    color: var(--primary-color);
    font-size: 1.2rem;
    width: 20px;
}

.references ul {
    list-style: none;
}

.references li {
    margin-bottom: 1rem;
    color: var(--text-gray);
    padding-left: 1.5rem;
    position: relative;
}

.references li::before {
    content: '•';
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-size: 1.5rem;
}


/* Footer */

.footer {
    background: var(--darker-bg);
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid rgba(255, 215, 0, 0.2);
}

.footer p {
    color: var(--text-gray);
}


/* Chatbot */

.chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    pointer-events: auto;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: all 0.3s ease;
    position: relative;
    z-index: 10000;
    border: none;
    outline: none;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
}

.chatbot-toggle i {
    font-size: 1.5rem;
    color: var(--darker-bg);
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--dark-bg);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 15px;
    display: none;
    flex-direction: column;
    box-shadow: var(--shadow-card);
}

.chatbot-window.active {
    display: flex;
}

.chatbot-header {
    background: var(--gradient-primary);
    color: var(--darker-bg);
    padding: 1rem;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header h4 {
    margin: 0;
    font-size: 1rem;
}

.chatbot-controls {
    display: flex;
    gap: 8px;
}

.settings-btn,
.close-btn {
    background: none;
    border: none;
    color: var(--darker-bg);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px;
    border-radius: 50%;
    transition: background 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover,
.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.chatbot-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 80%;
    padding: 0.8rem 1rem;
    border-radius: 15px;
    word-wrap: break-word;
    font-family: 'Open Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.message-content {
    font-family: 'Open Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.bot-message {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    align-self: flex-start;
}

.user-message {
    background: var(--gradient-primary);
    color: var(--darker-bg);
    align-self: flex-end;
}

.typing-indicator {
    opacity: 0.8;
}

.typing-indicator .dots {
    animation: typing 1.5s infinite;
}

@keyframes typing {
    0%, 20% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff9800;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: #4CAF50;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.chatbot-input {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    border-top: 1px solid rgba(255, 215, 0, 0.2);
}

.chatbot-input input {
    flex: 1;
    padding: 0.8rem;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    outline: none;
}

.chatbot-input input:focus {
    border-color: var(--primary-color);
}

.chatbot-input button {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    color: var(--darker-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chatbot-input button:hover {
    transform: scale(1.1);
}


/* AI Settings Modal */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--dark-bg);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideInDown 0.3s ease-out;
}

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

.modal-header {
    background: var(--gradient-primary);
    color: var(--darker-bg);
    padding: 1.5rem;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.modal-close {
    background: none;
    border: none;
    color: var(--darker-bg);
    cursor: pointer;
    font-size: 1.3rem;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.3s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.modal-body {
    padding: 2rem;
}

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

.setting-group label {
    display: block;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.setting-group input {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.setting-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.2);
}

.setting-group small {
    display: block;
    color: var(--text-gray);
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.setting-group small a {
    color: var(--primary-color);
    text-decoration: none;
}

.setting-group small a:hover {
    text-decoration: underline;
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-text {
    color: var(--text-light);
    font-weight: 500;
}

.setting-group .btn {
    margin-right: 1rem;
    margin-top: 0.5rem;
}


/* User Memory Management */

.memory-info {
    background: var(--secondary-bg);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--primary-color);
}

.memory-stats {
    color: var(--text-color);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 4px;
}

.btn-warning {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    border: none;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e55a2b, #e8841a);
    transform: translateY(-1px);
}


/* Back to Top */

.back-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    color: var(--darker-bg);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow-glow);
    transition: all 0.3s ease;
    z-index: 999;
}

.back-to-top:hover {
    transform: translateY(-3px);
}

.back-to-top.show {
    display: flex;
}


/* Live Demo Section */

.demo-section {
    padding: 5rem 0;
    background: var(--secondary-bg);
}

/* Database Section */
.database-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 30px;
    margin-top: 40px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.database-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.database-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: flex-end;
}

.database-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.database-stats .stat-card {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.database-stats .stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.database-stats .stat-label {
    font-size: 0.9rem;
    color: var(--text-gray);
}

.database-list {
    max-height: 400px;
    overflow-y: auto;
}

.database-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.database-image {
    width: 80px;
    height: 60px;
    border-radius: 5px;
    object-fit: cover;
}

.database-info {
    flex: 1;
}

.database-time {
    font-size: 0.9rem;
    color: var(--text-gray);
}

.database-status {
    font-weight: bold;
    margin: 5px 0;
}

.database-status.sleeping {
    color: #ff4444;
}

.database-status.drowsy {
    color: #ffaa00;
}

.database-actions {
    display: flex;
    gap: 5px;
}

.db-status {
    color: #ff0000;
    font-weight: bold;
}

.db-status.connected {
    color: #00ff00;
}

.demo-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.video-section {
    background: var(--darker-bg);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#canvas {
    display: none;
}

.detection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: visible;
}

/* Enhanced Face Detection Styles */
.face-box {
    position: absolute;
    border: 4px solid #00ff00;
    border-radius: 12px;
    background: rgba(0, 255, 0, 0.05);
    transition: all 0.3s ease;
    box-shadow: 0 0 12px rgba(0, 255, 0, 0.4);
    aspect-ratio: 1;
    z-index: 1000;
    pointer-events: none;
    min-width: 50px;
    min-height: 50px;
}

.face-box.drowsy {
    border-color: #ffaa00;
    background: rgba(255, 170, 0, 0.1);
    box-shadow: 0 0 12px rgba(255, 170, 0, 0.6);
}

.face-box.sleeping {
    border-color: #ff0000;
    background: rgba(255, 0, 0, 0.1);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
    animation: pulse-alert 1s infinite;
}

/* Màu sắc khác nhau cho từng người */
.face-box:nth-child(1) { border-color: #00ff00; }
.face-box:nth-child(2) { border-color: #0080ff; }
.face-box:nth-child(3) { border-color: #ff00ff; }
.face-box:nth-child(4) { border-color: #ffff00; }
.face-box:nth-child(5) { border-color: #00ffff; }
.face-box:nth-child(6) { border-color: #ff8000; }
.face-box:nth-child(7) { border-color: #8000ff; }
.face-box:nth-child(8) { border-color: #80ff00; }
.face-box:nth-child(9) { border-color: #ff0080; }
.face-box:nth-child(10) { border-color: #008080; }

@keyframes pulse-alert {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.face-label {
    position: absolute;
    top: -30px;
    left: 0;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    z-index: 1000;
}

.face-info-box {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px;
    border-radius: 5px;
    font-size: 10px;
    max-width: 150px;
    transform: translate(-50%, -100%);
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.face-info-box .person-title {
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 4px;
}

.face-info-box .info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.face-info-box .info-label {
    color: #cccccc;
}

.face-info-box .info-value {
    color: #ffffff;
    font-weight: 500;
}

.status-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff6b35;
    animation: pulse 2s infinite;
}

.status-indicator.active .status-dot {
    background: #4CAF50;
}

.status-indicator.detecting .status-dot {
    background: #ff9800;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.demo-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.demo-controls .btn {
    flex: 1;
    min-width: 120px;
}

#stopDemo {
    display: none;
}

.detection-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-card {
    background: var(--darker-bg);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.info-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detection-stats {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--secondary-bg);
    border-radius: 8px;
}

.stat-label {
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    color: var(--primary-color);
    font-weight: 600;
}

.detection-history {
    margin-top: 1rem;
}

.detection-history h4 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.history-list {
    max-height: 120px;
    overflow-y: auto;
    background: var(--secondary-bg);
    border-radius: 8px;
    padding: 0.5rem;
}

.history-item {
    padding: 0.3rem 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--primary-color);
}

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

.no-history {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8rem;
}

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

.setting-group label {
    display: block;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.setting-group input[type="range"] {
    width: 100%;
    margin-bottom: 0.5rem;
}

.setting-group select {
    width: 100%;
    background: var(--secondary-bg);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 0.5rem;
    color: var(--text-color);
    font-family: inherit;
}

#sensitivityValue {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.demo-instructions {
    margin-top: 3rem;
    background: var(--darker-bg);
    border-radius: 15px;
    padding: 2rem;
}

.demo-instructions h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--secondary-bg);
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.step-number {
    background: var(--gradient-primary);
    color: var(--darker-bg);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.instruction-item p {
    margin: 0;
    color: var(--text-color);
    font-size: 0.9rem;
    line-height: 1.4;
}


/* Detection Overlays */

.detection-box {
    position: absolute;
    border: 3px solid #4CAF50;
    border-radius: 5px;
    background: rgba(76, 175, 80, 0.1);
}

.detection-box.drowsy {
    border-color: #ff9800;
    background: rgba(255, 152, 0, 0.1);
}

.detection-box.sleeping {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.1);
}

.detection-label {
    position: absolute;
    top: -25px;
    left: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}


/* Responsive Design */

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--darker-bg);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 2rem 0;
    }
    .nav-menu.active {
        left: 0;
    }
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }
    .hero-title {
        font-size: 2.5rem;
    }
    .ai-brain {
        font-size: 8rem;
    }
    .section-title {
        font-size: 2rem;
    }
    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .chatbot-window {
        width: 300px;
        height: 400px;
        right: -20px;
    }
    .back-to-top {
        left: 20px;
        bottom: 20px;
    }
    /* Demo responsive */
    .demo-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .demo-controls {
        justify-content: center;
    }
    .instruction-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    .hero-title {
        font-size: 2rem;
    }
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    .btn {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .chatbot-window {
        width: 280px;
        right: -40px;
    }
    /* Demo mobile */
    .demo-section {
        padding: 3rem 0;
    }
    .video-section,
    .info-card {
        padding: 1rem;
    }
    .demo-controls .btn {
        min-width: 100px;
        font-size: 0.8rem;
    }
    .instruction-item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
}


/* Smooth Scrolling */

html {
    scroll-behavior: smooth;
}


/* Loading Animation */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}


/* Custom Scrollbar */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}