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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    padding: 20px;
    color: #e0e0e0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: #1e1e2e;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    padding: 40px;
    border: 1px solid #2d2d3e;
}

h1 {
    text-align: center;
    color: #ffffff;
    margin-bottom: 10px;
    font-size: 2.5em;
}

.subtitle {
    text-align: center;
    color: #b0b0b0;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.mode-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: center;
}

.mode-btn {
    padding: 15px 30px;
    border: 2px solid #667eea;
    background: #2d2d3e;
    color: #a0a0ff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.3s;
}

.mode-btn.active {
    background: #667eea;
    color: white;
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    background: #5568d3;
}

.mode-btn.active:hover {
    background: #5568d3;
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #e0e0e0;
    font-weight: 600;
    font-size: 1em;
}

select, input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #3d3d4e;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
    background: #2d2d3e;
    color: #e0e0e0;
}

select:focus, input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    background: #353545;
}

select option {
    background: #2d2d3e;
    color: #e0e0e0;
}

select option:disabled {
    color: #666;
}

.audio-mode-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
}

.audio-mode-btn {
    padding: 12px 25px;
    border: 2px solid #667eea;
    background: #2d2d3e;
    color: #a0a0ff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
}

.audio-mode-btn.active {
    background: #667eea;
    color: white;
}

.audio-mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    background: #5568d3;
}

.audio-mode-btn.active:hover {
    background: #5568d3;
}

.audio-controls {
    margin: 30px 0;
    text-align: center;
}

.audio-upload {
    margin: 30px 0;
    text-align: center;
}

.file-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: #2d2d3e;
    border: 2px dashed #667eea;
    border-radius: 10px;
    cursor: pointer;
    color: #a0a0ff;
    font-weight: 600;
    font-size: 1.1em;
    transition: all 0.3s;
}

.file-upload-label:hover {
    background: #353545;
    border-color: #8b9aff;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.file-upload-icon {
    font-size: 1.3em;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
    padding: 12px 20px;
    background: #252535;
    border-radius: 8px;
    border: 1px solid #3d3d4e;
    color: #e0e0e0;
}

.file-info span {
    flex: 1;
    font-size: 0.95em;
}

.file-remove-btn {
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    margin-left: 10px;
}

.file-remove-btn:hover {
    background: #da190b;
    transform: scale(1.1);
}

.file-hint {
    display: block;
    margin-top: 10px;
    color: #888;
    font-size: 0.85em;
}

.record-btn {
    padding: 15px 40px;
    font-size: 1.2em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    margin: 0 10px;
}

.record-btn.start {
    background: #2d5a3d;
    color: white;
}

.record-btn.start:hover {
    background: #3a6b4a;
    transform: scale(1.05);
}

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

.record-btn.stop:hover {
    background: #da190b;
    transform: scale(1.05);
}

.record-btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    color: #888;
}

.process-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.2em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 20px;
    transition: all 0.3s;
}

.process-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.5);
}

.process-btn:disabled {
    background: #555;
    cursor: not-allowed;
    color: #888;
}

.results {
    margin-top: 30px;
    padding: 25px;
    background: #252535;
    border-radius: 10px;
    display: none;
    border: 1px solid #3d3d4e;
}

.results.show {
    display: block;
}

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

.result-label {
    font-weight: 600;
    color: #8b9aff;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.result-text {
    color: #e0e0e0;
    line-height: 1.6;
    padding: 15px;
    background: #1e1e2e;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.result-text a {
    color: #8b9aff;
    text-decoration: none;
    font-weight: 600;
}

.result-text a:hover {
    color: #a0a0ff;
    text-decoration: underline;
}

.result-text small {
    color: #888;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #8b9aff;
    font-size: 1.1em;
    display: none;
}

.loading.show {
    display: block;
}

.spinner {
    border: 4px solid #2d2d3e;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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

.error {
    background: #3d1e1e;
    color: #ff6b6b;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    display: none;
    border: 1px solid #5a2a2a;
}

.error.show {
    display: block;
}

.audio-visualizer {
    height: 60px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.bar {
    width: 4px;
    background: #667eea;
    border-radius: 2px;
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { height: 10px; }
    50% { height: 40px; }
}

.hidden {
    display: none;
}

/* History Section */
.history-section {
    margin-top: 40px;
    padding: 30px;
    background: #252535;
    border-radius: 10px;
    border: 1px solid #3d3d4e;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #3d3d4e;
}

.history-header h2 {
    color: #ffffff;
    font-size: 1.8em;
    margin: 0;
}

.history-actions {
    display: flex;
    gap: 10px;
}

.refresh-btn,
.download-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s;
}

.refresh-btn:hover,
.download-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.download-btn {
    background: #4caf50;
}

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

.history-container {
    min-height: 100px;
}

.history-loading {
    text-align: center;
    padding: 20px;
    color: #8b9aff;
    font-size: 1.1em;
}

.history-empty {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 1.1em;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.history-item {
    background: #1e1e2e;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #3d3d4e;
    transition: all 0.3s;
}

.history-item:hover {
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.history-item-header {
    margin-bottom: 15px;
}

.history-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.history-date {
    color: #8b9aff;
    font-weight: 600;
    font-size: 0.95em;
}

.history-mode {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
}

.history-model {
    color: #b0b0b0;
    font-size: 0.9em;
    background: #2d2d3e;
    padding: 4px 12px;
    border-radius: 15px;
}

.history-item-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-transcript,
.history-translation {
    padding: 15px;
    background: #252535;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.history-transcript strong,
.history-translation strong {
    color: #8b9aff;
    display: block;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.history-transcript p,
.history-translation p {
    color: #e0e0e0;
    line-height: 1.6;
    margin: 0;
    word-wrap: break-word;
}

.history-audio {
    padding: 10px 15px;
    background: #2d2d3e;
    border-radius: 8px;
    align-items: center;
    display: flex;
    gap: 23px;
}

.history-audio a {
    color: #8b9aff;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.history-audio a:hover {
    color: #a0a0ff;
    text-decoration: underline;
}

/* Uploaded Files List Styles */
.uploaded-files-section {
    margin-top: 20px;
    padding: 15px;
    background: #2d2d3e;
    border-radius: 10px;
    border: 1px solid #3d3d4e;
}

.uploaded-files-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
}

.uploaded-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #1e1e2e;
    border-radius: 8px;
    border: 1px solid #3d3d4e;
    transition: all 0.3s;
}

.uploaded-file-item:hover {
    background: #252535;
    border-color: #667eea;
}

.uploaded-file-item.selected {
    background: #2d3d5e;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.uploaded-file-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.uploaded-file-name {
    color: #e0e0e0;
    font-weight: 500;
    margin-bottom: 4px;
    word-break: break-word;
}

.uploaded-file-meta {
    color: #888;
    font-size: 0.85em;
}

.select-file-btn {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
    margin-left: 10px;
}

.select-file-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.uploaded-files-loading,
.uploaded-files-empty,
.uploaded-files-error {
    text-align: center;
    color: #888;
    padding: 20px;
    font-style: italic;
}

.uploaded-files-error {
    color: #ff6b6b;
}

/* View All History Button */
.view-all-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    font-size: 0.95em;
}

.view-all-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

