/* K-Tech Voice Player Styles - Clean & High Specificity (No Redundant !important) */

:root {
    --ktech-voice-accent: #ef3636;
    --ktech-voice-accent-hover: #dc2626;
    --ktech-voice-bg: #ffffff;
    --ktech-voice-border: #e2e8f0;
    --ktech-voice-text: #1e293b;
    --ktech-voice-muted: #64748b;
    --ktech-voice-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
}

#ktech-voice-player.ktech-voice-player-container {
    margin: 24px 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    clear: both;
    box-sizing: border-box;
}

#ktech-voice-player * {
    box-sizing: border-box;
}

#ktech-voice-player .ktech-voice-player-inner {
    background: var(--ktech-voice-bg);
    border: 1px solid var(--ktech-voice-border);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: var(--ktech-voice-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
}

#ktech-voice-player .ktech-voice-player-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--ktech-voice-accent);
    border-radius: 16px 0 0 16px;
}

/* Header Section */
#ktech-voice-player .ktech-voice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

#ktech-voice-player .ktech-voice-title-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

#ktech-voice-player .ktech-voice-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--ktech-voice-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

#ktech-voice-player .kv-icon-speaker {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    display: block;
}

/* Wave animation */
#ktech-voice-player .ktech-voice-wave-anim {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}

#ktech-voice-player.is-playing .kv-icon-speaker {
    display: none !important;
}

#ktech-voice-player.is-playing .ktech-voice-wave-anim {
    display: flex !important;
}

#ktech-voice-player .ktech-voice-wave-anim span {
    width: 3px;
    background-color: var(--ktech-voice-accent);
    border-radius: 2px;
    animation: kvWave 1.2s ease-in-out infinite alternate;
}

#ktech-voice-player .ktech-voice-wave-anim span:nth-child(1) { height: 14px; animation-delay: 0.1s; }
#ktech-voice-player .ktech-voice-wave-anim span:nth-child(2) { height: 8px;  animation-delay: 0.3s; }
#ktech-voice-player .ktech-voice-wave-anim span:nth-child(3) { height: 16px; animation-delay: 0.2s; }
#ktech-voice-player .ktech-voice-wave-anim span:nth-child(4) { height: 10px; animation-delay: 0.4s; }

@keyframes kvWave {
    0% { height: 4px; }
    100% { height: 16px; }
}

#ktech-voice-player .ktech-voice-info {
    display: flex;
    flex-direction: column;
}

#ktech-voice-player .ktech-voice-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--ktech-voice-text);
    line-height: 1.2;
}

#ktech-voice-player .ktech-voice-meta {
    font-size: 12px;
    color: var(--ktech-voice-muted);
    margin-top: 2px;
}

/* Extra Section (Reading Time & Voice Select) */
#ktech-voice-player .ktech-voice-extra {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

#ktech-voice-player .ktech-voice-reading-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--ktech-voice-muted);
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

#ktech-voice-player .ktech-voice-reading-time svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    display: inline-block;
    flex-shrink: 0;
}

#ktech-voice-player .ktech-voice-select {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--ktech-voice-border);
    background: #fff;
    color: var(--ktech-voice-text);
    outline: none;
    cursor: pointer;
    max-width: 220px;
    text-overflow: ellipsis;
    white-space: nowrap;
    height: 32px;
    line-height: 1;
}

#ktech-voice-player .ktech-voice-select:focus {
    border-color: var(--ktech-voice-accent);
}

/* Controls Section */
#ktech-voice-player .ktech-voice-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

#ktech-voice-player .ktech-voice-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#ktech-voice-player .kv-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

#ktech-voice-player .kv-btn svg {
    display: block;
    width: 16px;
    height: 16px;
    margin: 0 auto;
}

#ktech-voice-player .kv-btn-play {
    background: var(--ktech-voice-accent);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

#ktech-voice-player .kv-btn-play:hover {
    background: var(--ktech-voice-accent-hover);
    transform: scale(1.05);
}

#ktech-voice-player .kv-btn-play svg.kv-icon-play,
#ktech-voice-player .kv-btn-play svg.kv-icon-pause {
    fill: #ffffff !important;
    stroke: none !important;
}

#ktech-voice-player .kv-btn-stop {
    background: #f1f5f9;
    color: #64748b;
}

#ktech-voice-player .kv-btn-stop:hover {
    background: #e2e8f0;
    color: #ef4444;
}

#ktech-voice-player .kv-btn-stop svg {
    width: 14px;
    height: 14px;
    fill: currentColor !important;
    stroke: none !important;
}

/* Progress Bar */
#ktech-voice-player .ktech-voice-progress-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

#ktech-voice-player .ktech-voice-progress-bar {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

#ktech-voice-player .ktech-voice-progress-fill {
    width: 0%;
    height: 100%;
    background: var(--ktech-voice-accent);
    border-radius: 3px;
    transition: width 0.2s linear;
}

#ktech-voice-player .ktech-voice-time-display {
    font-size: 12px;
    font-weight: 600;
    color: var(--ktech-voice-muted);
    min-width: 32px;
    text-align: right;
}

/* Speed Dropdown Menu (Custom Div Component) */
#ktech-voice-player .ktech-voice-speed-box {
    position: relative;
    flex-shrink: 0;
}

#ktech-voice-player .kv-speed-dropdown {
    position: relative;
    display: inline-block;
}

#ktech-voice-player .kv-speed-btn {
    border: 1px solid var(--ktech-voice-border);
    background: #f8fafc;
    color: var(--ktech-voice-text);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    line-height: 1;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

#ktech-voice-player .kv-speed-btn:hover,
#ktech-voice-player .kv-speed-dropdown.is-open .kv-speed-btn {
    border-color: var(--ktech-voice-accent);
    color: var(--ktech-voice-accent);
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

#ktech-voice-player .kv-speed-arrow {
    transition: transform 0.2s ease;
}

#ktech-voice-player .kv-speed-dropdown.is-open .kv-speed-arrow {
    transform: rotate(180deg);
}

#ktech-voice-player .kv-speed-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border: 1px solid var(--ktech-voice-border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    padding: 6px;
    min-width: 90px;
    z-index: 99999;
}

#ktech-voice-player .kv-speed-dropdown.is-open .kv-speed-menu {
    display: block;
    animation: kvPopIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes kvPopIn {
    0% { opacity: 0; transform: translateY(6px); }
    100% { opacity: 1; transform: translateY(0); }
}

#ktech-voice-player .kv-speed-option {
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ktech-voice-text);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

#ktech-voice-player .kv-speed-option:hover {
    background: #f1f5f9;
    color: var(--ktech-voice-accent);
}

#ktech-voice-player .kv-speed-option.active {
    background: var(--ktech-voice-accent);
    color: #ffffff;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    #ktech-voice-player .ktech-voice-player-inner {
        padding: 14px;
    }

    #ktech-voice-player .ktech-voice-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    #ktech-voice-player .ktech-voice-extra {
        width: 100%;
        justify-content: space-between;
    }

    #ktech-voice-player .ktech-voice-select {
        max-width: 160px;
    }

    #ktech-voice-player .ktech-voice-controls {
        gap: 10px;
    }
}
