/* Dark theme CSS for Speech to Text PWA */

:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --accent: #007bff;
    --accent-hover: #0056b3;
    --error: #dc3545;
    --success: #28a745;
    --border: #404040;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    margin: 0 auto;
}

header {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    position: relative;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.install-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: var(--accent);
    color: var(--text-primary);
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.install-button:hover {
    background-color: var(--accent-hover);
    transform: scale(1.05);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
}

.controls {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.language-select {
    width: 100%;
    max-width: 300px;
    padding: 0.75rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.language-select:focus {
    outline: none;
    border-color: var(--accent);
}

.record-button {
    width: 100%;
    max-width: 300px;
    height: 80px;
    background-color: var(--accent);
    color: var(--text-primary);
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    margin: 1rem auto 0;
}

.record-button:hover {
    background-color: var(--accent-hover);
    transform: scale(1.02);
}

.record-button:active {
    transform: scale(0.98);
}

.record-button.recording {
    background-color: var(--error);
    animation: pulse 1.5s infinite;
}

.record-button.recording:hover {
    background-color: #c82333;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(220, 53, 69, 0.6);
    }
    100% {
        box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    }
}

.text-display {
    flex: 1;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    min-height: 200px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.text-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 1rem;
}

.text-content:empty::before {
    content: "Recognized text will appear here...";
    color: var(--text-secondary);
    font-style: italic;
}

/* Full width on small screens */
@media (max-width: 768px) {
    .container, main {
        width: 100%;
    }
    .controls, .language-select, .text-display, .record-button {
        width: 100%;
        max-width: none;
    }
    .record-button {
        height: 70px;
        font-size: 1.1rem;
        margin-left: 0;
        margin-right: 0;
    }
    .language-select {
        font-size: 1rem;
    }
    .text-display {
        max-height: calc(100vh - 250px);
    }
}

/* Constrain width on large screens */
@media (min-width: 769px) {
    .language-select, .record-button, .text-display {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }
    .controls {
        justify-content: center;
    }
}

/* Status indicator */
.status-indicator {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    transition: background-color 0.3s ease;
}

.status-indicator.recording {
    background-color: var(--error);
    animation: blink 1s infinite;
}

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

/* Error states */
.error {
    border-color: var(--error) !important;
}

.success {
    border-color: var(--success) !important;
}

/* Loading state */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .record-button {
        transition: none;
    }

    .record-button.recording {
        animation: none;
    }

    .status-indicator.recording {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg-primary: #000000;
        --bg-secondary: #000000;
        --text-primary: #ffffff;
        --border: #ffffff;
    }
}