/* style.css */
:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-primary: #f5f5f5;
    --text-secondary: #a0a0a0;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --success-color: #10b981;
    --border-color: #333;
    --glow-primary: rgba(99, 102, 241, 0.5);
    --glow-danger: rgba(239, 68, 68, 0.5);
    --glow-success: rgba(16, 185, 129, 0.5);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

header {
    text-align: center;
    margin-bottom: 10px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #a855f7, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    text-align: center;
}

.input-group {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

input[type="time"] {
    background-color: #2a2a2a;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-size: 3rem;
    font-weight: 800;
    padding: 12px 24px;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.3s ease;
    text-align: center;
}

input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

input[type="time"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--glow-primary);
}

.btn-group {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 0 15px var(--glow-primary);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
    box-shadow: 0 0 15px var(--glow-danger);
}

.hidden {
    display: none !important;
}

#active-alarm-info {
    margin-top: 24px;
    text-align: center;
    padding: 16px;
    background-color: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

#active-alarm-info p {
    margin-bottom: 8px;
}

#active-alarm-info p:last-child {
    margin-bottom: 0;
}

.status-text {
    color: var(--primary-color);
    font-weight: 600;
    animation: pulse 2s infinite;
}

/* Alarm Active Section */
.alert-banner {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: 0 0 20px var(--glow-danger);
}

.alert-banner h2 {
    color: var(--danger-color);
    margin-bottom: 8px;
}

.pulsate {
    animation: pulsate 1s infinite;
}

.challenge-box {
    text-align: center;
    margin-bottom: 24px;
}

.target-text {
    font-size: 2rem;
    color: var(--success-color);
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.camera-wrapper {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background-color: #000;
    margin-bottom: 24px;
    aspect-ratio: 1; /* Keep it square like TM output */
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--border-color);
}

#webcam-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.detection-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#detection-status {
    font-weight: 600;
    text-shadow: 1px 1px 2px black;
}

.progress-container {
    width: 100%;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--danger-color);
    transition: width 0.1s linear, background-color 0.3s;
}

#confidence-text {
    font-weight: 800;
    font-size: 1.2rem;
    text-shadow: 1px 1px 2px black;
}

.hint-box {
    background-color: rgba(255,255,255,0.05);
    padding: 16px;
    border-radius: 8px;
}

.hint-box p {
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

#available-labels-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    justify-content: center;
}

#available-labels-list li {
    background-color: #333;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    color: #ccc;
}

.success-banner {
    text-align: center;
    padding: 20px;
}

.success-banner h2 {
    color: var(--success-color);
    font-size: 2.5rem;
}

.mt-4 {
    margin-top: 24px;
}

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

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

/* Loader */
#loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(18, 18, 18, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.loader {
    border: 5px solid #333;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 480px) {
    .card {
        padding: 20px;
    }
    input[type="time"] {
        font-size: 2.5rem;
    }
    h1 {
        font-size: 2rem;
    }
}
