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

body {
    font-family: 'Kanit', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
    min-height: 100vh;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    border-radius: 20px;
    padding: 15px 25px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(25px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2), 
                0 5px 15px rgba(118, 75, 162, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 80px;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.8s ease;
}

.header:hover::before {
    left: 100%;
}

.header:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.3);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Mascot Styles */
.mascot-display {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    padding: 10px;
    position: relative;
}

.mascot-image {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    object-fit: cover;
    border: 6px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4),
                0 0 0 10px rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    background: white;
}

/* Idle State */
.mascot-display.idle .mascot-image {
    animation: mascotFloat 3s ease-in-out infinite;
}

/* Speaking State */
.mascot-display.speaking .mascot-image {
    animation: mascotSpeak 0.5s ease-in-out infinite;
    border-color: #3b82f6;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.6);
}

/* Listening State */
.mascot-display.listening .mascot-image {
    animation: mascotListen 1s ease-in-out infinite;
    border-color: #ef4444;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.6);
    transform: scale(1.05);
}

.mascot-image:hover {
    transform: scale(1.05) rotate(5deg);
    box-shadow: 0 20px 50px rgba(102, 126, 234, 0.5),
                0 0 0 12px rgba(255, 255, 255, 0.3);
}

@keyframes mascotFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes mascotSpeak {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@keyframes mascotListen {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

@keyframes mascotFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Removed old logo-image styles from header */
.logo-text h1 {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.logo-text p {
    font-size: 0.9rem;
    opacity: 0.9;
}
    filter: brightness(1.2) contrast(1.2);
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-section h1 {
    font-size: 3.2em;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #f8f9ff 50%, #fff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-shadow: 0 4px 8px rgba(255, 255, 255, 0.3);
    letter-spacing: -1px;
    animation: shimmer 3s ease-in-out infinite;
    position: relative;
}

@keyframes shimmer {
    0%, 100% {
        background: linear-gradient(135deg, #fff 0%, #f8f9ff 50%, #fff 100%);
    }
    50% {
        background: linear-gradient(135deg, #f0f4ff 0%, #fff 50%, #f0f4ff 100%);
    }
}

.college-name {
    font-size: 1.3em;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    letter-spacing: 0.8px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

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

.status-dot.online {
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.status-text {
    font-weight: 600;
    color: #10b981;
    font-size: 1.1em;
}

.admin-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.95em;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.admin-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
    background: linear-gradient(135deg, #d97706, #b45309);
}

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

.status-dot.online {
    background: #48bb78;
}

.status-dot.offline {
    background: #f56565;
}

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

.status-text {
    font-weight: 500;
    color: #4a5568;
}

.admin-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #4299e1;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.admin-link:hover {
    background: #3182ce;
    transform: translateY(-2px);
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    height: calc(100vh - 140px);
}

/* Chat Section */
.chat-section {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chat-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: -200% 0; }
    50% { background-position: 200% 0; }
}

.chat-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.chat-messages {
    height: 100%;
    overflow-y: auto;
    padding-right: 15px;
    scroll-behavior: smooth;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
}

.message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeInUp 0.3s ease;
}

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

.message-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6em;
    margin-right: 15px;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.ai-message .message-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    animation: aiGlow 3s ease-in-out infinite alternate;
}

@keyframes aiGlow {
    from { box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3); }
    to { box-shadow: 0 6px 25px rgba(118, 75, 162, 0.4); }
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
    margin-right: 0;
    margin-left: 15px;
    animation: userPulse 2s ease-in-out infinite;
}

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

.message-content {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 18px 24px;
    border-radius: 20px;
    max-width: 80%;
    word-wrap: break-word;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    position: relative;
}

.message-content:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.user-message .message-content {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.message-content p {
    margin-bottom: 10px;
    line-height: 1.7;
    font-size: 1.05em;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Input Section */
.input-section {
    margin-top: 20px;
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
}

.voice-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.voice-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Kanit', sans-serif;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.voice-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.voice-btn:hover::before {
    left: 100%;
}

.voice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.voice-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.language-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
}

.voice-type-btn {
    background: linear-gradient(135deg, #ed64a6, #d53f8c);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
}

.toggle-tts-btn:hover, .language-btn:hover, .voice-type-btn:hover {
    transform: translateY(-2px);
}

.language-btn:hover {
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.4);
}

.voice-type-btn:hover {
    box-shadow: 0 8px 25px rgba(237, 100, 166, 0.4);
}

.toggle-tts-btn.browser-mode {
    background: linear-gradient(135deg, #9f7aea, #805ad5);
}

.toggle-tts-btn.browser-mode:hover {
    box-shadow: 0 8px 25px rgba(159, 122, 234, 0.4);
}

.language-btn.english {
    background: linear-gradient(135deg, #e53e3e, #c53030);
}

.language-btn.english:hover {
    box-shadow: 0 8px 25px rgba(229, 62, 62, 0.4);
}

.voice-btn.listening {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    animation: pulse 1s infinite;
}

.voice-btn.processing {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
}

.voice-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tts-mode {
    font-size: 12px;
    color: #4299e1;
    font-weight: 600;
    padding: 3px 8px;
    background: rgba(66, 153, 225, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(66, 153, 225, 0.2);
}

.voice-status {
    font-size: 14px;
    color: #718096;
    font-weight: 500;
}

.language-status {
    font-size: 12px;
    color: #38a169;
    font-weight: 600;
    padding: 3px 8px;
    background: rgba(56, 161, 105, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(56, 161, 105, 0.2);
}

.voice-type-status {
    font-size: 12px;
    color: #d53f8c;
    font-weight: 600;
    padding: 3px 8px;
    background: rgba(213, 63, 140, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(213, 63, 140, 0.2);
}

.text-input-container {
    display: flex;
    gap: 10px;
}

#textInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-size: 16px;
    font-family: 'Kanit', sans-serif;
    outline: none;
    transition: border-color 0.3s ease;
}

#textInput:focus {
    border-color: #667eea;
}

.send-btn {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    border: none;
    border-radius: 50%;
    width: 55px;
    height: 55px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 20px rgba(72, 187, 120, 0.3);
    position: relative;
    overflow: hidden;
}

.send-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: all 0.4s ease;
    transform: translate(-50%, -50%);
}

.send-btn:hover::before {
    width: 120%;
    height: 120%;
}

.send-btn:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 12px 30px rgba(72, 187, 120, 0.5);
}

.send-btn:active {
    transform: scale(0.95);
    transition: all 0.1s ease;
}

/* Transcript Section */
.transcript-section {
    margin-top: 15px;
    padding: 15px;
    background: #edf2f7;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.transcript-label {
    font-size: 14px;
    color: #4a5568;
    font-weight: 600;
    margin-bottom: 8px;
}

.transcript-text {
    font-size: 16px;
    color: #2d3748;
    line-height: 1.5;
}

/* Camera Section */
.camera-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.camera-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    aspect-ratio: 4/3;
}

#cameraVideo {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: cover;
    background: #1a202c;
}

.camera-overlay {
    position: absolute;
    top: 30px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.camera-status {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.camera-toggle {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2em;
    transition: background 0.3s ease;
}

.camera-toggle:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* IoT Status */
.iot-status {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.iot-status h3 {
    margin-bottom: 20px;
    color: #4a5568;
    font-size: 1.3em;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
    gap: 10px;
}

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

.status-label {
    color: #718096;
    font-weight: 500;
}

.status-value {
    color: #2d3748;
    font-weight: 600;
    flex-grow: 1;
    text-align: right;
}

/* IoT Control Buttons */
.iot-control-btn {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.iot-control-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(237, 137, 54, 0.4);
}

.iot-control-btn:active {
    transform: scale(0.95);
}

.iot-controls {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    color: #4a5568;
}

.status-indicator {
    font-size: 8px;
    line-height: 1;
}

.status-text {
    font-weight: 600;
}

.last-check {
    margin-left: auto;
    font-size: 11px;
    color: #718096;
}

.controls-row {
    display: flex;
    gap: 10px;
}

.iot-refresh-btn {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
    flex: 1;
}

.iot-refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
}

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

.iot-test-btn {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
    flex: 1;
}

.iot-test-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(237, 137, 54, 0.4);
}

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

.device-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

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

.status-label {
    font-weight: 500;
    color: #4a5568;
    min-width: 120px;
}

.status-value {
    font-weight: 600;
    color: #2d3748;
    text-align: right;
    margin-right: 10px;
}

.iot-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Responsive IoT Status */
@media (max-width: 768px) {
    .header {
        padding: 20px 25px;
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .logo-container {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .logo-image {
        width: 60px;
        height: 60px;
    }
    
    .logo-section h1 {
        font-size: 2.5em;
    }
    
    .college-name {
        font-size: 1.1em;
    }
    
    .status-indicator {
        justify-content: center;
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .device-info {
        font-size: 14px;
    }
    
    .status-label {
        min-width: 100px;
    }
    
    .iot-controls {
        flex-direction: column;
    }
    
    .iot-test-btn,
    .iot-refresh-btn {
        justify-content: center;
    }
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 249, 255, 0.98));
    padding: 40px 50px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3), 
                0 8px 20px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 1000;
    animation: loadingPulse 2s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3), 
                    0 8px 20px rgba(0, 0, 0, 0.1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
        box-shadow: 0 25px 70px rgba(102, 126, 234, 0.4), 
                    0 10px 25px rgba(0, 0, 0, 0.15);
    }
}

.spinner {
    width: 35px;
    height: 35px;
    position: relative;
}

.spinner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top: 4px solid #667eea;
    border-right: 4px solid #764ba2;
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}

.spinner::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    width: calc(100% - 12px);
    height: calc(100% - 12px);
    border: 2px solid transparent;
    border-bottom: 2px solid #48bb78;
    border-left: 2px solid #38a169;
    border-radius: 50%;
    animation: spin 0.8s linear infinite reverse;
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
    
    .camera-section {
        flex-direction: row;
    }
    
    .camera-container {
        flex: 1;
        aspect-ratio: 16/9;
    }
    
    .iot-status {
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .logo-section h1 {
        font-size: 2em;
    }
    
    .main-content {
        height: calc(100vh - 120px);
    }
    
    .chat-section {
        padding: 20px;
    }
    
    .camera-section {
        flex-direction: column;
    }
    
    .voice-controls {
        flex-wrap: wrap;
    }
    
    .message-content {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .logo-section h1 {
        font-size: 1.8em;
    }
    
    .college-name {
        font-size: 1em;
    }
    
    .chat-section,
    .camera-container,
    .iot-status {
        padding: 15px;
    }
    
    .voice-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    #textInput {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .container {
        min-height: -webkit-fill-available;
    }
    
    #cameraVideo {
        -webkit-playsinline: true;
    }
}

/* Hide elements for screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Example Question Buttons */
.example-question {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 2px solid #cbd5e0;
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    font-size: 0.9em;
    font-weight: 500;
    color: #2d3748;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
}

.example-question:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.example-question:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* Advanced Animations and Effects */
@keyframes floatUp {
    0% { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    100% { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideInFromLeft {
    0% { 
        opacity: 0; 
        transform: translateX(-50px); 
    }
    100% { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

@keyframes slideInFromRight {
    0% { 
        opacity: 0; 
        transform: translateX(50px); 
    }
    100% { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

/* Apply entrance animations */
.header {
    animation: floatUp 0.8s ease-out;
}

.chat-section {
    animation: slideInFromLeft 0.8s ease-out 0.2s both;
}

.camera-section {
    animation: slideInFromRight 0.8s ease-out 0.4s both;
}

.message {
    animation: floatUp 0.5s ease-out;
}

/* Improved scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
}

/* Enhanced focus states for accessibility */
.text-input:focus {
    outline: none;
    border: 2px solid #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    transform: scale(1.02);
}

button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Pulse animation for active voice button */
.voice-btn.listening {
    animation: voicePulse 1.5s ease-in-out infinite;
}

@keyframes voicePulse {
    0%, 100% {
        box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 8px 20px rgba(239, 68, 68, 0.6),
                    0 0 0 10px rgba(239, 68, 68, 0.1),
                    0 0 0 20px rgba(239, 68, 68, 0.05);
    }
}

/* Status indicator animations */
.status-dot.online {
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
}

/* Improved hover effects for IoT controls */
.iot-control-btn:hover,
.iot-refresh-btn:hover,
.iot-test-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* Smooth transitions for all interactive elements */
* {
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

/* Glass morphism effect for containers */
.container {
    position: relative;
}

.container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(72, 187, 120, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Professional Footer */
.footer {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95), rgba(118, 75, 162, 0.95));
    border-radius: 25px;
    margin-top: 40px;
    padding: 35px 40px 25px;
    backdrop-filter: blur(20px);
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: slideInFromLeft 0.8s ease-out 0.6s both;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 25px;
}

.footer-section h4 {
    color: white;
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.footer-section p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 8px;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.9em;
    padding: 8px 15px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.footer-links a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .footer {
        padding: 25px 20px 20px;
        margin-top: 30px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-links {
        justify-content: center;
    }
}
