/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Class Selection Styles */
.class-selection {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.class-selection h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
    font-size: 2rem;
}

.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.class-card {
    background: linear-gradient(145deg, #f0f4f8, #e2e8f0);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.class-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
    border-color: #667eea;
}

.class-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.class-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #2d3748;
}

.class-info {
    margin-bottom: 1.5rem;
}

.occupancy {
    display: block;
    font-weight: bold;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.status {
    display: block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.status.empty {
    background: #e2e8f0;
    color: #718096;
}

.status.waiting {
    background: #fef5e7;
    color: #d69e2e;
}

.status.active {
    background: #c6f6d5;
    color: #38a169;
}

.status.full {
    background: #fed7d7;
    color: #e53e3e;
}

.join-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.join-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 8px 15px rgba(102, 126, 234, 0.4);
}

.join-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
}

.student-info {
    text-align: center;
}

.student-info input {
    padding: 1rem 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1.1rem;
    width: 300px;
    max-width: 100%;
    text-align: center;
    transition: all 0.3s ease;
}

.student-info input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Classroom Styles */
.classroom-body {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    color: white;
}

.classroom-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.classroom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
}

.class-info h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.lesson-info {
    opacity: 0.8;
    font-size: 1rem;
}

.leave-btn {
    padding: 0.5rem 1rem;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.leave-btn:hover {
    background: #c53030;
}

.classroom-main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr auto;
    gap: 1rem;
    height: calc(100vh - 120px);
}

/* Teacher Section */
.teacher-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.teacher-avatar {
    position: relative;
    margin-bottom: 1rem;
}

.avatar-icon {
    font-size: 4rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.teacher-status {
    text-align: center;
}

.teacher-status h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

#teacherStatus {
    font-size: 1.1rem;
    opacity: 0.8;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
}

/* Audio Visualizer */
.audio-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 40px;
    margin-top: 1rem;
}

.wave-bar {
    width: 4px;
    background: linear-gradient(to top, #667eea, #764ba2);
    border-radius: 2px;
    animation: wave 1.5s ease-in-out infinite;
}

.wave-bar:nth-child(1) { animation-delay: 0s; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 100% { height: 10px; }
    50% { height: 30px; }
}

.audio-visualizer.active .wave-bar {
    animation-play-state: running;
}

.audio-visualizer:not(.active) .wave-bar {
    height: 10px;
    animation-play-state: paused;
}

/* Students Section */
.students-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
}

.students-section h3 {
    margin-bottom: 1rem;
    text-align: center;
}

.students-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: calc(100% - 60px);
    overflow-y: auto;
}

.student-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.student-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38a169, #48bb78);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.student-info-item {
    flex: 1;
}

.student-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.student-status {
    font-size: 0.9rem;
    opacity: 0.8;
}

.student-item.speaking {
    background: rgba(102, 126, 234, 0.3);
    border: 2px solid #667eea;
}

.student-item.hand-raised {
    background: rgba(237, 137, 54, 0.3);
    border: 2px solid #ed8936;
}

/* Controls Section */
.controls-section {
    grid-column: 1 / -1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    backdrop-filter: blur(10px);
}

.control-btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
}

.raise-hand {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.raise-hand:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 8px 15px rgba(237, 137, 54, 0.4);
}

.raise-hand.active {
    background: linear-gradient(135deg, #dd6b20 0%, #c05621 100%);
    animation: pulse 2s infinite;
}

.speak {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    color: white;
}

.speak:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 8px 15px rgba(56, 161, 105, 0.4);
}

.speak.active {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    animation: pulse 2s infinite;
}

.control-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Mic Visualizer */
.mic-visualizer {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 30px;
}

.mic-wave-bar {
    width: 3px;
    background: linear-gradient(to top, #38a169, #48bb78);
    border-radius: 2px;
    height: 8px;
    transition: all 0.3s ease;
}

.mic-visualizer.active .mic-wave-bar {
    animation: micWave 0.5s ease-in-out infinite alternate;
}

.mic-wave-bar:nth-child(1) { animation-delay: 0s; }
.mic-wave-bar:nth-child(2) { animation-delay: 0.1s; }
.mic-wave-bar:nth-child(3) { animation-delay: 0.2s; }

@keyframes micWave {
    from { height: 8px; }
    to { height: 25px; }
}

/* Status Overlay */
.status-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.status-overlay.hidden {
    display: none;
}

.status-content {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    color: #333;
    max-width: 400px;
    width: 90%;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#statusMessage {
    font-size: 1.1rem;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .classroom-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
    }
    
    .class-grid {
        grid-template-columns: 1fr;
    }
    
    .controls-section {
        flex-direction: column;
        gap: 1rem;
    }
    
    .control-btn {
        width: 100%;
        min-width: auto;
    }
    
    .classroom-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .class-selection {
        padding: 1rem;
    }
    
    .student-info input {
        width: 100%;
    }
}
