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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Image Section */
.image-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    grid-row: span 2;
}

.image-container {
    position: relative;
    text-align: center;
}

.image-container img {
    width: 100%;
    max-width: 400px;
    height: 300px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.change-image-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.change-image-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

/* Speech Section */
.speech-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.speech-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.control-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.start-btn {
    background: #4CAF50;
    color: white;
}

.start-btn:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-2px);
}

.stop-btn {
    background: #f44336;
    color: white;
}

.stop-btn:hover:not(:disabled) {
    background: #da190b;
    transform: translateY(-2px);
}

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

/* Status Display */
.status-display {
    text-align: center;
}

.status-text {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 15px;
}

.listening-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #4CAF50;
    font-weight: 600;
}

.listening-indicator.active {
    display: flex;
}

.pulse {
    width: 20px;
    height: 20px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* Text Section */
.text-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    grid-column: span 2;
}

.text-container h3 {
    margin-bottom: 15px;
    color: #333;
}

.speech-text {
    min-height: 120px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    font-size: 1.1rem;
    line-height: 1.6;
}

.speech-text .placeholder {
    color: #999;
    font-style: italic;
}

/* AI Section */
.ai-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    grid-column: span 2;
}

.ai-container h3 {
    margin-bottom: 15px;
    color: #333;
}

.ai-suggestion {
    min-height: 100px;
    padding: 15px;
    background: #e8f5e8;
    border-radius: 10px;
    border-left: 4px solid #4CAF50;
    font-size: 1.1rem;
    line-height: 1.6;
}

.ai-suggestion .placeholder {
    color: #999;
    font-style: italic;
}

.loading-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    color: #667eea;
}

.loading-indicator.active {
    display: flex;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 20px;
    right: 20px;
}

.settings-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.settings-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.setting-item input,
.setting-item select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.setting-item input[type="range"] {
    margin-bottom: 5px;
}

.setting-item small {
    color: #666;
    font-size: 0.9rem;
}

.save-btn,
.close-btn {
    padding: 12px 25px;
    margin: 10px 5px 0 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
}

.save-btn {
    background: #4CAF50;
    color: white;
}

.close-btn {
    background: #f44336;
    color: white;
}

.save-btn:hover {
    background: #45a049;
}

.close-btn:hover {
    background: #da190b;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .speech-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 200px;
    }
    
    .text-section,
    .ai-section {
        grid-column: span 1;
    }
}

/* Animation for text updates */
.text-update {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}