/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* Main container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Header */
h1 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 30px;
    font-size: 2.5em;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Speaker selection */
.speaker-selection {
    margin-bottom: 20px;
    text-align: center;
}

.speaker-selection label {
    display: inline-block;
    margin-right: 10px;
    font-weight: 600;
    color: #4a5568;
}

.speaker-selection select {
    padding: 8px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #4a5568;
    font-size: 14px;
    min-width: 200px;
    transition: border-color 0.3s ease;
}

.speaker-selection select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    min-width: 160px;
}

.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;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.btn-danger {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.2);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn:disabled::before {
    display: none;
}

/* Status cards */
.status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.status-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-left: 4px solid #667eea;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.status-card h3 {
    margin: 0 0 10px 0;
    color: #4a5568;
    font-size: 1.1em;
    font-weight: 600;
}

.status-value {
    font-size: 1.5em;
    font-weight: 700;
    color: #667eea;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Conversation area */
.conversation {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.conversation::-webkit-scrollbar {
    width: 8px;
}

.conversation::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.conversation::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 4px;
}

.conversation::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #5a6fd8, #6a42a0);
}

/* Messages */
.message {
    margin: 15px 0;
    padding: 15px;
    border-radius: 15px;
    animation: fadeIn 0.3s ease;
    position: relative;
    word-wrap: break-word;
}

.message.user {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    margin-left: 20%;
    border-bottom-right-radius: 5px;
}

.message.assistant {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    margin-right: 20%;
    border-bottom-left-radius: 5px;
    color: #2d3748;
}

.message.system {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    text-align: center;
    font-style: italic;
    color: #c53030;
    margin: 10px 0;
}

.message.acknowledgment {
    background: linear-gradient(135deg, #f0fff4, #e6fffa);
    border: 1px solid #68d391;
    margin-left: 30%;
    margin-right: 30%;
    text-align: center;
    font-style: italic;
    color: #2f855a;
    border-radius: 25px;
}

.message.interruption {
    background: linear-gradient(135deg, #fef5e7, #fed7aa);
    border: 1px solid #ed8936;
    margin-left: 25%;
    margin-right: 25%;
    text-align: center;
    color: #c05621;
    border-radius: 12px;
}

/* Message metadata */
.timing-info {
    font-size: 0.8em;
    opacity: 0.7;
    margin-top: 8px;
    font-style: italic;
}

.classification-info {
    font-size: 0.75em;
    opacity: 0.8;
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
}

/* Indicators */
.recording-indicator,
.interruption-indicator {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 25px;
    color: white;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    animation: pulse 1.5s infinite;
}

.recording-indicator {
    background: linear-gradient(45deg, #ff4757, #ff3742);
}

.interruption-indicator {
    background: linear-gradient(45deg, #ffa502, #ff8c00);
    top: 80px;
}

.recording-indicator.active,
.interruption-indicator.active {
    display: block;
}

/* Animations */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(15px) scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

@keyframes pulse {
    0% { 
        transform: scale(1); 
        opacity: 1; 
    }
    50% { 
        transform: scale(1.05); 
        opacity: 0.8; 
    }
    100% { 
        transform: scale(1); 
        opacity: 1; 
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin: 12px 0;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, .2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, .2) 50%,
        rgba(255, 255, 255, .2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 20px 20px;
    animation: move 1s linear infinite;
}

@keyframes move {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 20px 20px;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
        border-radius: 15px;
    }
    
    h1 {
        font-size: 2em;
        margin-bottom: 20px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        margin: 5px 0;
    }
    
    .status {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .status-card {
        padding: 15px;
    }
    
    .status-value {
        font-size: 1.2em;
    }
    
    .message.user {
        margin-left: 10%;
    }
    
    .message.assistant {
        margin-right: 10%;
    }
    
    .message.acknowledgment {
        margin-left: 15%;
        margin-right: 15%;
    }
    
    .message.interruption {
        margin-left: 10%;
        margin-right: 10%;
    }
    
    .recording-indicator,
    .interruption-indicator {
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }
    
    .interruption-indicator {
        top: 70px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
        margin: 5px;
    }
    
    h1 {
        font-size: 1.5em;
    }
    
    .status {
        grid-template-columns: 1fr;
    }
    
    .conversation {
        max-height: 300px;
        padding: 15px;
    }
    
    .message {
        padding: 12px;
        margin: 10px 0;
    }
    
    .message.user,
    .message.assistant,
    .message.acknowledgment,
    .message.interruption {
        margin-left: 5%;
        margin-right: 5%;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    }
    
    .container {
        background: rgba(45, 55, 72, 0.95);
        color: #e2e8f0;
    }
    
    h1 {
        color: #e2e8f0;
    }
    
    .status-card {
        background: #4a5568;
        border-left-color: #81c784;
    }
    
    .status-card h3 {
        color: #e2e8f0;
    }
    
    .status-value {
        color: #81c784;
    }
    
    .conversation {
        background: #4a5568;
        border-color: rgba(129, 199, 132, 0.2);
    }
    
    .message.assistant {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .speaker-selection select {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #4a5568;
    }
}

/* Accessibility improvements */
.btn:focus,
.speaker-selection select:focus {
    outline: 3px solid #81c784;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .container {
        border: 2px solid #000;
    }
    
    .btn {
        border: 2px solid #000;
    }
    
    .status-card {
        border: 1px solid #000;
    }
}