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

body {
    font-family: 'Cal Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

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

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

.header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 15px;
    background: linear-gradient(45deg, #00ff88, #00ccff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff4444;
    transition: background 0.3s ease;
}

.status-dot.active {
    background: #00ff88;
    animation: pulse 2s infinite;
}

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

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.audio-visualizer {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#waveformCanvas {
    width: 100%;
    height: 200px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
}

.volume-meter {
    margin-top: 15px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.volume-bar {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #ffff00, #ff4444);
    width: 0%;
    transition: width 0.1s ease;
    border-radius: 10px;
}

.detection-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.current-detection {
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detection-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    opacity: 0.6;
}

.pulse-ring {
    width: 80px;
    height: 80px;
    border: 3px solid #00ff88;
    border-radius: 50%;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.animal-detection {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.animal-detection img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 3px solid #00ff88;
}

.animal-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #00ff88;
}

.confidence {
    font-size: 1rem;
    opacity: 0.8;
}

.speech-bubble {
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    padding: 10px 15px;
    border-radius: 20px;
    margin-top: 15px;
    font-size: 0.9rem;
    max-width: 200px;
    word-wrap: break-word;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(255, 255, 255, 0.9);
}

.sidescroller-container {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidescroller {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.sidescroller::-webkit-scrollbar {
    height: 8px;
}

.sidescroller::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidescroller::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.animal-card {
    flex-shrink: 0;
    width: 180px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    position: relative;
    animation: slideIn 0.5s ease;
    transition: transform 0.3s ease;
}

.animal-card:hover {
    transform: translateY(-5px);
}

.animal-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 2px solid #00ff88;
}

.animal-card .animal-name {
    font-size: 1rem;
    margin-bottom: 5px;
}

.animal-card .timestamp {
    font-size: 0.8rem;
    opacity: 0.6;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.control-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-btn.primary {
    background: linear-gradient(45deg, #00ff88, #00ccff);
    color: #000;
}

.control-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 255, 136, 0.3);
}

.control-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.control-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

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

@keyframes slideIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

.chat-container {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #00ff88;
    margin: 0;
}

.clear-chat-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.clear-chat-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 300px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.chat-placeholder {
    text-align: center;
    opacity: 0.6;
    font-style: italic;
    padding: 20px;
}

.chat-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-left: 3px solid #00ff88;
    animation: slideInChat 0.3s ease;
}

.chat-message img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #00ff88;
    flex-shrink: 0;
}

.chat-content {
    flex: 1;
    min-width: 0;
}

.chat-animal-name {
    font-weight: 600;
    color: #00ff88;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.chat-timestamp {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-bottom: 8px;
}

.chat-confidence {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 8px;
}

.chat-speech {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    position: relative;
    max-width: fit-content;
}

.chat-speech-language {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 4px;
    font-style: italic;
}

@keyframes slideInChat {
    from { 
        opacity: 0; 
        transform: translateX(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 200px;
    }
}