/* =====================================================
   Speech Text to PDF - Tool Styles
   ===================================================== */

/* ===== Main Container ===== */
.tool-wrapper[data-tool="speech-text-to-pdf"] {
    font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    color: #1e293b;
}

/* =====================================================
   Status Indicator
   ===================================================== */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    border: 1px solid #e9edf2;
    margin-bottom: 1.25rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #94a3b8;
    flex-shrink: 0;
    transition: background 0.3s;
}

.status-dot.recording {
    background: #dc2626;
    animation: pulse-dot 1s ease-in-out infinite;
}

.status-dot.processing {
    background: #f59e0b;
    animation: pulse-dot 0.8s ease-in-out infinite;
}

.status-dot.ready {
    background: #0b7e3d;
}

.status-dot.error {
    background: #dc2626;
}

@keyframes pulse-dot {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.4);
        opacity: 0.6;
    }
}

.status-text {
    font-weight: 500;
    font-size: 0.9rem;
    color: #1e293b;
}

/* =====================================================
   Action Buttons
   ===================================================== */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.action-buttons .btn {
    padding: 0.6rem 1.8rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.action-buttons .btn:active {
    transform: scale(0.97);
}

.action-buttons .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.action-buttons .btn-primary {
    background: #0067b8;
    color: #ffffff;
}

.action-buttons .btn-primary:hover:not(:disabled) {
    background: #005499;
    box-shadow: 0 4px 12px rgba(0, 103, 184, 0.25);
}

.action-buttons .btn-danger {
    background: #dc2626;
    color: #ffffff;
}

.action-buttons .btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.action-buttons .btn-success {
    background: #0b7e3d;
    color: #ffffff;
}

.action-buttons .btn-success:hover:not(:disabled) {
    background: #096633;
    box-shadow: 0 4px 12px rgba(11, 126, 61, 0.25);
}

.action-buttons .btn-secondary {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #d1d9e6;
}

.action-buttons .btn-secondary:hover {
    background: #e2e8f0;
}

.action-buttons .btn-recording {
    background: #dc2626;
    color: #ffffff;
    animation: pulse-btn 1.5s ease-in-out infinite;
}

@keyframes pulse-btn {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(220, 38, 38, 0);
    }
}

/* =====================================================
   Transcription Section
   ===================================================== */
.transcription-section {
    background: #ffffff;
    border: 1px solid #e9edf2;
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.25rem;
}

.transcription-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.transcription-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.transcription-title i {
    color: #0067b8;
}

.transcription-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.word-count {
    font-size: 0.8rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.15rem 0.8rem;
    border-radius: 1rem;
    font-weight: 500;
}

.transcription-container {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: #fafbfc;
    border: 1px solid #e9edf2;
    border-radius: 0.5rem;
    font-size: 1rem;
    line-height: 1.8;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s;
}

.transcription-container:focus {
    border-color: #0067b8;
    box-shadow: 0 0 0 3px rgba(0, 103, 184, 0.08);
}

.transcription-container:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
    pointer-events: none;
}

.transcription-container .interim-text {
    color: #94a3b8;
    font-style: italic;
}

.transcription-container .final-text {
    color: #1e293b;
}

/* =====================================================
   Settings Panel
   ===================================================== */
.tool-settings {
    background: #ffffff;
    border: 1px solid #e9edf2;
    border-radius: 1rem;
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.25rem;
}

.tool-settings h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.tool-settings h3 i {
    color: #0067b8;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.5rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.option-group label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.option-group label i {
    color: #0067b8;
    width: 1.1rem;
}

.option-select,
.option-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d9e6;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.option-select:focus,
.option-input:focus {
    border-color: #0067b8;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 103, 184, 0.12);
}

.option-select {
    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='%2364758b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

.option-input::placeholder {
    color: #9ca3af;
    font-size: 0.85rem;
}

/* =====================================================
   Progress & Success
   ===================================================== */
.progress-container {
    background: #e9edf2;
    border-radius: 2rem;
    height: 24px;
    margin: 1rem 0 0.5rem 0;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0067b8, #3b8fd9);
    border-radius: 2rem;
    transition: width 0.4s ease;
}

.progress-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.3px;
}

.success-message {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 0.75rem;
    padding: 0.75rem 1.25rem;
    margin: 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #065f46;
    font-weight: 500;
    font-size: 0.9rem;
}

.success-message i {
    color: #0b7e3d;
    font-size: 1.25rem;
}

/* =====================================================
   Error Message
   ===================================================== */
.error-message {
    background: #fef2f2;
    border-left: 4px solid #dc2626;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    color: #991b1b;
    font-weight: 500;
    font-size: 0.9rem;
    display: none;
}

.error-message.show {
    display: block;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 768px) {
    .tool-wrapper[data-tool="speech-text-to-pdf"] {
        padding: 0 0.5rem;
        margin: 1rem auto;
    }

    .options-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .action-buttons .btn {
        justify-content: center;
        width: 100%;
    }

    .action-buttons > div {
        flex-direction: column;
        width: 100%;
    }

    .transcription-container {
        min-height: 150px;
        max-height: 300px;
        font-size: 0.9rem;
        padding: 0.75rem;
    }

    .transcription-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .status-indicator {
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
    }

    .tool-settings {
        padding: 1rem 1rem;
    }

    .tool-settings h3 {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .action-buttons .btn {
        padding: 0.4rem 1rem;
        font-size: 0.8rem;
    }

    .transcription-container {
        min-height: 120px;
        max-height: 250px;
        font-size: 0.85rem;
        padding: 0.5rem;
    }

    .tool-settings {
        padding: 0.75rem;
    }

    .status-indicator {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }

    .status-dot {
        width: 10px;
        height: 10px;
    }

    .status-text {
        font-size: 0.8rem;
    }

    .word-count {
        font-size: 0.7rem;
        padding: 0.1rem 0.6rem;
    }

    .option-group label {
        font-size: 0.75rem;
    }

    .option-select,
    .option-input {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
}

/* =====================================================
   RTL Support
   ===================================================== */
html[dir="rtl"] .action-buttons .btn i {
    margin-left: 0.4rem;
    margin-right: 0;
}

html[dir="rtl"] .transcription-title i {
    margin-left: 0.4rem;
    margin-right: 0;
}

html[dir="rtl"] .option-group label i {
    margin-left: 0.4rem;
    margin-right: 0;
}

html[dir="rtl"] .option-select {
    background-position: left 12px center;
    padding-right: 0.75rem;
    padding-left: 32px;
}

html[dir="rtl"] .success-message i {
    margin-left: 0.4rem;
    margin-right: 0;
}