/**
 * Sound of Text — Professional TTS Tool Styles
 * Designed to integrate with the Sound of Text site design system
 */

/* ===== Section wrapper ===== */
.sot-tool {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1rem;
}

.sot-tool__header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.sot-tool__badge {
    display: inline-block;
    font-size: 1em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1d63ea;
    background: #eef3fc;
    border-radius: 100px;
    padding: 4px 14px;
    margin-bottom: 0.75rem;
}

.sot-tool__title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #111;
    margin: 0 0 0.5rem;
    line-height: 1.2;
}

.sot-tool__subtitle {
    font-size: 1em;
    color: #666;
    margin: 0;
    line-height: 1.55;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}


/* ===== Converter card ===== */
.sot-card {
    background: #fff;
    border: 1px solid #e0e4ea;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.02);
    overflow: visible;
    position: relative;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.sot-card:hover {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.09);
    border-color: #d0d4da;
}

.sot-card__body {
    padding: 0;
    position: relative;
}

/* ---- Textarea ---- */
.sot-card__textarea-wrap {
    position: relative;
}

.sot-card__textarea {
    display: block;
    width: 100%;
    min-height: 160px;
    padding: 1.25rem 2.75rem 1.25rem 1.25rem;
    border: none;
    border-radius: 16px 16px 0 0;
    resize: vertical;
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 1em;
    line-height: 1.65;
    color: #222;
    background: #fff;
    transition: background 0.2s ease;
    box-sizing: border-box;
}

.sot-card__textarea::placeholder {
    color: #adb5bd;
}

.sot-card__textarea:focus {
    outline: none;
    background: #fafbff;
}

.sot-card__clear {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f5f7;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #999;
    transition: all 0.2s ease;
    padding: 0;
}

.sot-card__clear:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: scale(1.08);
}


/* ---- Bottom bar ---- */
.sot-card__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.25rem;
    border-top: 1px solid #f0f1f3;
    gap: 1rem;
    min-height: 44px;
}

.sot-card__lang-select {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.15s ease;
    font-size: 0.85rem;
    color: #444;
    font-weight: 500;
    user-select: none;
    -webkit-user-select: none;
}

.sot-card__lang-select:hover {
    background: #f4f5f7;
}

.sot-card__lang-icon {
    flex-shrink: 0;
    color: #1d63ea;
}

.sot-card__chevron {
    flex-shrink: 0;
    color: #999;
    transition: transform 0.2s ease;
}

.sot-card__lang-select.open .sot-card__chevron {
    transform: rotate(180deg);
}

.sot-card__counter {
    font-size: 0.78rem;
    color: #aaa;
    font-weight: 500;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}


/* ---- Language dropdown ---- */
.sot-card__lang-dropdown {
    display: none;
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 56px;
    background: #fff;
    border: 1px solid #e0e4ea;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    z-index: 100;
    overflow: hidden;
    max-height: 320px;
    display: none;
}

.sot-card__lang-dropdown.show {
    display: block;
    animation: sotDropIn 0.18s ease-out;
}

@keyframes sotDropIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sot-card__lang-search-wrap {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f1f3;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.sot-card__lang-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e4ea;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.sot-card__lang-search:focus {
    border-color: #1d63ea;
    box-shadow: 0 0 0 3px rgba(29, 99, 234, 0.1);
}

.sot-card__lang-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 6px 0;
}

.sot-card__lang-list>div {
    padding: 8px 20px;
    cursor: pointer;
    font-size: 1em;
    color: #444;
    transition: background 0.12s ease, color 0.12s ease;
}

.sot-card__lang-list>div:hover {
    background: #1d63ea;
    color: #fff;
}

.sot-card__lang-list>div.selected {
    font-weight: 600;
    color: #1d63ea;
    background: #eef3fc;
}

.sot-card__lang-list>div.selected:hover {
    color: #fff;
    background: #1d63ea;
}

/* custom scrollbar */
.sot-card__lang-list::-webkit-scrollbar {
    width: 6px;
}

.sot-card__lang-list::-webkit-scrollbar-track {
    background: transparent;
}

.sot-card__lang-list::-webkit-scrollbar-thumb {
    background: #d0d4da;
    border-radius: 10px;
}

.sot-card__lang-list::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}


/* ---- Convert button ---- */
.sot-card__convert {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: #1d63ea;
    color: #fff;
    border: none;
    border-radius: 0 0 16px 16px;
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.12s ease;
    letter-spacing: 0.01em;
}

.sot-card__convert:hover {
    background: #1554cc;
}

.sot-card__convert:active {
    transform: scale(0.985);
    background: #124ab8;
}

.sot-card__convert:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sot-card__convert svg {
    flex-shrink: 0;
}


/* ===== History panel ===== */
.sot-history {
    display: none;
    margin-top: 1.5rem;
    background: #fff;
    border: 1px solid #e0e4ea;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.sot-history__toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f1f3;
    background: #fafbfc;
}

.sot-history__controls {
    display: flex;
    gap: 4px;
}

.sot-history__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #555;
    transition: all 0.15s ease;
    padding: 0;
}

.sot-history__btn:hover {
    background: #f0f1f3;
    color: #1d63ea;
}

.sot-history__clear {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid #e0e4ea;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.sot-history__clear:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* saved-data container */
.sot-history .saved-data {
    max-height: 400px;
    overflow-y: auto;
}

.sot-history .saved-data::-webkit-scrollbar {
    width: 6px;
}

.sot-history .saved-data::-webkit-scrollbar-track {
    background: transparent;
}

.sot-history .saved-data::-webkit-scrollbar-thumb {
    background: #d0d4da;
    border-radius: 10px;
}

/* individual result items */
.sot-history .saved-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 16px;
    gap: 12px;
    transition: background 0.2s ease;
}

.sot-history .saved-item:not(:last-child) {
    border-bottom: 1px solid #f0f1f3;
}

.sot-history .saved-item>div {
    flex-grow: 1;
    min-width: 0;
}

.sot-history .saved-item p {
    margin: 0 0 6px;
    font-size: 1em;
    color: #444;
    line-height: 1.5;
    word-break: break-word;
}

.sot-history .saved-item p strong {
    color: #222;
    font-weight: 600;
}

.sot-history .saved-item .audio {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    width: 100%;
    min-width: 0;
}

.sot-history .saved-item audio {
    height: 36px;
    max-width: 100%;
    width: 100%;
    border-radius: 8px;
    outline: none;
    min-width: 80px;
}

.sot-history .saved-item .audio svg {
    display: none;
    max-width: 28px;
    max-height: 28px;
    opacity: 0.5;
    cursor: pointer;
    color: #1d63ea;
    transition: opacity 0.15s ease;
}

.sot-history .saved-item .audio svg:hover {
    opacity: 1;
}

.sot-history .saved-item button.delete-item {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    transition: all 0.15s ease;
}

.sot-history .saved-item button.delete-item:hover {
    background: #fee2e2;
    color: #ef4444;
}

.sot-history .saved-item button.delete-item svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.sot-history .saved-item.playing {
    background: #f0f6ff;
}


/* ===== Spinner animation ===== */
@keyframes sotSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.sot-spinner {
    animation: sotSpin 0.8s linear infinite;
    flex-shrink: 0;
}

/* ===== Download link ===== */
.download-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: #1d63ea;
    opacity: 0.6;
    transition: all 0.15s ease;
    flex-shrink: 0;
    text-decoration: none;
}

.download-link:hover {
    opacity: 1;
    background: #eef3fc;
}


/* ===== Responsive ===== */
@media (max-width: 640px) {
    .sot-tool__title {
        font-size: 1.4rem;
    }

    .sot-tool__subtitle {
        font-size: 1em;
    }

    .sot-card__textarea {
        min-height: 130px;
        padding: 1rem 2.5rem 1rem 1rem;
        font-size: 1em;
    }

    .sot-card__bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
    }

    .sot-card__convert {
        padding: 12px 20px;
        font-size: 1em;
    }

    .sot-card__lang-dropdown {
        left: 8px;
        right: 8px;
    }
}