/* ========================================
   VOICE TO TEXT CONVERTER - MAIN STYLES
   ======================================== */

/* ===== Tool Navigation ===== */
.tool-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 60px;
    z-index: 40;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.85);
}

.tool-nav .container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.tool-nav-back {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.tool-nav-back:hover {
    color: var(--primary);
}

.tool-nav-title {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

/* ===== Main Wrapper ===== */
.calculator-wrapper {
    padding: 24px 0 60px;
}

.calc-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.calc-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
    color: var(--primary);
}

.calc-icon svg {
    width: 28px;
    height: 28px;
}

.calc-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.calc-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.calc-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 1024px) {
    .calc-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Left Column ===== */
.calc-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 140px;
}

@media (max-width: 1024px) {
    .calc-form {
        position: static;
    }
}

/* ===== Settings Group ===== */
.settings-group {
    background: var(--bg);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.settings-group h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.settings-row {
    margin-bottom: 12px;
}

.settings-row:last-child {
    margin-bottom: 0;
}

.settings-row label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* ===== Language Select ===== */
.language-select {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.language-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

/* Dark mode for language select */
@media (prefers-color-scheme: dark) {
    .language-select {
        background-color: var(--bg);
        color: var(--text);
    }
    .language-select option {
        background-color: var(--bg);
        color: var(--text);
    }
}

/* ===== Recording Controls ===== */
.recording-controls {
    display: flex;
    gap: 10px;
}

.record-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: white;
}

.record-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

.record-btn.stop {
    background: #ef4444;
}

.record-btn.stop:hover {
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

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

.record-btn svg {
    flex-shrink: 0;
}

/* Recording button pulse animation */
.record-btn.recording {
    animation: pulse-record 1.5s ease-in-out infinite;
    background: #ef4444;
}

@keyframes pulse-record {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

/* ===== Recording Status ===== */
.recording-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.3s;
}

.status-dot.idle {
    background: var(--text-muted);
}

.status-dot.recording {
    background: #ef4444;
    animation: blink-dot 0.8s ease-in-out infinite;
}

.status-dot.processing {
    background: #f59e0b;
    animation: pulse-dot 0.8s ease-in-out infinite;
}

.status-dot.success {
    background: #10b981;
}

.status-dot.error {
    background: #ef4444;
    animation: blink-dot 0.8s ease-in-out infinite;
}

/* Status dot animations */
@keyframes blink-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ===== Recording Timer ===== */
.recording-timer {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
}

.recording-timer.active {
    color: #ef4444;
}

/* ===== Upload Area ===== */
.upload-area-small {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.upload-area-small:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-area-small.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.02);
}

.upload-area-small.dragover .upload-icon-small svg {
    color: var(--primary);
}

.upload-icon-small svg {
    color: var(--text-muted);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--primary-light);
    border-radius: 8px;
    margin-top: 10px;
    font-size: 0.85rem;
}

.file-info #fileName {
    flex: 1;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-info #fileSize {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.remove-file-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 4px;
    transition: var(--transition);
}

.remove-file-btn:hover {
    color: #ef4444;
}

.transcribe-btn {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.transcribe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

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

/* ===== Action Buttons ===== */
.action-buttons {
    display: flex;
    gap: 10px;
}

.calc-btn {
    flex: 1;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(37, 99, 235, 0.35);
}

.calc-btn.secondary {
    background: var(--bg);
    color: var(--text-secondary);
    box-shadow: none;
    border: 1.5px solid var(--border);
}

.calc-btn.secondary:hover {
    border-color: #ef4444;
    color: #ef4444;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.15);
}

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

/* ===== Statistics ===== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow);
}

.stat-card.highlight {
    background: var(--primary);
    border-color: var(--primary);
}

.stat-card.highlight .stat-label {
    color: rgba(255, 255, 255, 0.8);
}

.stat-card.highlight .stat-value {
    color: white;
}

.stat-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* ===== Text Output ===== */
.text-output-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.text-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.toolbar-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.toolbar-btn:active {
    transform: scale(0.95);
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toolbar-btn.copied {
    border-color: #10b981;
    color: #10b981;
    background: #10b98120;
}

.text-status {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: color 0.3s;
}

.text-status.success {
    color: #10b981;
}

.text-status.error {
    color: #ef4444;
}

.text-output {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text);
    background: var(--surface);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.text-output:focus {
    outline: none;
}

/* Transcription line styles */
.text-output .transcription-line {
    margin-bottom: 4px;
}

.text-output .transcription-line.paragraph {
    margin-bottom: 12px;
}

.text-output .placeholder-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 260px;
    color: var(--text-muted);
    text-align: center;
    gap: 8px;
}

.text-output .placeholder-text svg {
    color: var(--border);
}

.text-output .placeholder-text p {
    font-size: 1rem;
    margin: 0;
}

.text-output .placeholder-text span {
    font-size: 0.85rem;
}

/* Custom scrollbar */
.text-output::-webkit-scrollbar {
    width: 4px;
}

.text-output::-webkit-scrollbar-track {
    background: transparent;
}

.text-output::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ===== Loading Spinner ===== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Word Count Badge ===== */
.word-count-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
}

/* ===== SEO Content ===== */
.seo-content {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.seo-inner {
    max-width: 760px;
}

.seo-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
    letter-spacing: -0.02em;
}

.seo-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 10px;
    color: var(--text);
}

.seo-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 18px;
    margin-bottom: 8px;
    color: var(--text);
}

.seo-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 14px;
}

.seo-content ul {
    list-style: none;
    padding: 0;
    margin-bottom: 16px;
}

.seo-content ul li {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.7;
    padding: 4px 0 4px 24px;
    position: relative;
}

.seo-content ul li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 600;
}

.seo-content strong {
    color: var(--text);
}

/* ===== Highlight Box ===== */
.highlight-box {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 16px 20px;
    margin: 16px 0;
}

.highlight-box p {
    margin-bottom: 0;
    font-weight: 500;
    color: var(--text);
}

/* ===== Screenshot Figure ===== */
.screenshot-figure {
    margin: 20px 0 30px;
}

.screenshot-figure img {
    width: 100%;
    max-width: 760px;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    display: block;
}

.screenshot-figure figcaption {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

/* ===== Mobile Controls Wrapper ===== */
/* Эти классы используются в мобильной адаптации */
.controls-wrapper {
    display: contents; /* По умолчанию не влияет на десктоп */
}

.controls-top {
    display: contents;
}

.controls-actions {
    display: contents;
}

.controls-status {
    display: contents;
}

/* ===== Убедимся что на десктопе все как было ===== */
@media (min-width: 1025px) {
    .controls-wrapper,
    .controls-top,
    .controls-actions,
    .controls-status {
        display: contents;
    }
}