/* foor/style.css */
:root {
    --red-color: #ff4d4d;
    --yellow-color: #ffeb3b;
    --green-color: #4caf50;
    --gray-color: #9e9e9e;
    --bg-color: #f5f7fa;
    --text-color: #333;
    --card-bg: #fff;
}

html {
    min-height: 100%;
    background-color: var(--bg-color);
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    width: 100%;
}

/* Landing & Teacher */
.landing-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1; /* Allow to take available space */
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #3f51b5;
    color: white;
}
.btn-primary:hover {
    background-color: #303f9f;
}

.btn-large {
    font-size: 1.2rem;
    padding: 16px 32px;
}

.btn-outline {
    background: transparent;
    border: 2px solid #3f51b5;
    color: #3f51b5;
}

/* Teacher View */
.teacher-view header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 10px;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    padding: 10px;
    flex-wrap: wrap;
}

.stat-item {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    text-align: center;
    min-width: 100px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-bottom: 4px solid transparent;
    flex: 0 0 auto; /* Prevent shrinking */
}

.stat-item.red { border-color: var(--red-color); }
.stat-item.yellow { border-color: var(--yellow-color); }
.stat-item.green { border-color: var(--green-color); }
.stat-item.gray { border-color: var(--gray-color); }

.stat-item .count {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-item .label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.column {
    background: white;
    padding: 15px;
    border-radius: 12px;
    min-height: 200px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.column h3 {
    text-align: center;
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.red-column h3 { color: var(--red-color); }
.yellow-column h3 { color: #fbc02d; }
.green-column h3 { color: var(--green-color); }
.gray-column h3 { color: var(--gray-color); }

.column ul {
    list-style: none;
    padding: 0;
}

.column li {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95rem;
}

/* Student View */
.student-view {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.center-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    align-items: center; /* Center horizontally */
}

.input-field {
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    width: 100%;
    max-width: 300px;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.traffic-light {
    display: flex;
    flex-direction: column; /* Default stack vertically (mobile) */
    align-items: center;
    gap: 15px;
    background: #333;
    padding: 20px;
    border-radius: 30px;
    width: fit-content;
    margin: 10px auto;
}

.light {
    width: 90px; /* Smaller for mobile to fit screen */
    height: 90px;
    border-radius: 50%;
    border: none;
    background-color: #555 !important;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s, background-color 0.15s;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5) !important;
    -webkit-tap-highlight-color: transparent;
}

/* Override default when NOT active */
.light:not(.active) {
    background-color: #555 !important;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5) !important;
}

.light:active {
    transform: scale(0.95);
}

/* Active states - always show active */
.light.red.active {
    background-color: var(--red-color) !important;
    box-shadow: 0 0 40px var(--red-color) !important;
}
.light.yellow.active {
    background-color: var(--yellow-color) !important;
    box-shadow: 0 0 40px var(--yellow-color) !important;
}
.light.green.active {
    background-color: var(--green-color) !important;
    box-shadow: 0 0 40px var(--green-color) !important;
}

/* Hover states - only on devices with hover capability (not touch) */
@media (hover: hover) and (pointer: fine) {
    .light.red:hover {
        background-color: var(--red-color);
        box-shadow: 0 0 40px var(--red-color);
    }
    .light.yellow:hover {
        background-color: var(--yellow-color);
        box-shadow: 0 0 40px var(--yellow-color);
    }
    .light.green:hover {
        background-color: var(--green-color);
        box-shadow: 0 0 40px var(--green-color);
    }
}

#status-message {
    margin-top: 30px;
    font-size: 1.5rem;
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    position: relative;
    max-width: 90%;
}

.close {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

#qrcode {
    margin: 20px auto;
    cursor: zoom-in; /* Indicate clickable */
    transition: transform 0.2s;
}

#qrcode:hover {
    transform: scale(1.05);
}

#code-display {
    cursor: zoom-in;
    transition: transform 0.2s;
}

#code-display:hover {
    transform: scale(1.1);
}

/* Zoom overlay */
.zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    cursor: zoom-out;
    display: none;
}

.zoom-overlay.active {
    display: flex;
}

.zoom-overlay img {
    max-width: 90%;
    max-height: 80vh;
}

.zoom-overlay .zoomed-text {
    font-size: 5rem;
    font-weight: 800;
    color: #333;
}

/* Mobile - compact layout */
@media (max-width: 599px) {
    .student-view {
        min-height: 100dvh;
        min-height: 100vh;
    }
    
    .student-view .container {
        padding: 5px;
        height: calc(100dvh - 52px); /* Dynamic viewport height minus navbar */
        height: calc(100vh - 52px);
        box-sizing: border-box;
    }
    
    .student-view .center-content {
        justify-content: center; /* Center vertically */
        height: 100%;
    }
    
    .traffic-light {
        padding: 30px;
        gap: 25px;
        margin: 0 auto;
    }
    
    .light {
        width: 150px;
        height: 150px;
    }
    
    #status-message {
        margin-top: 25px;
        margin-bottom: 0;
        font-size: 1.7rem;
    }
    
    .name-display {
        margin-bottom: 8px;
        font-size: 1.5rem;
    }
    
    #join-screen h1 {
        font-size: 1.4rem;
        margin-bottom: 8px;
    }
    
    #join-screen p {
        margin-bottom: 12px;
    }
    
    .input-field {
        padding: 10px;
        font-size: 1rem;
        margin-bottom: 12px;
    }
}

/* Responsive - Mobile first, then tablet/desktop */
@media (min-width: 600px) {
    .traffic-light {
        flex-direction: row;
        padding: 30px 50px;
        gap: 35px;
    }
    
    .light {
        width: 100px;
        height: 100px;
    }
}

/* Tablet (iPad) */
@media (min-width: 768px) and (max-width: 1024px) {
    .traffic-light {
        flex-direction: row;
        padding: 40px 60px;
        gap: 50px;
    }
    
    .light {
        width: 140px;
        height: 140px;
    }
    
    #status-message {
        font-size: 1.8rem;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    .traffic-light {
        flex-direction: row;
        padding: 35px 55px;
        gap: 45px;
    }
    
    .light {
        width: 120px;
        height: 120px;
    }
}
