/**
 * Frontend CSS - Hason Voice WP
 * Styles cho player frontend
 */

/* Player Wrapper */
.hsv-player-wrapper {
    margin: 20px 0;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Hidden Content */
.hsv-content-hidden {
    display: none !important;
}

/* ===== BUTTON STYLE ===== */
.hsv-play-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.hsv-play-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    opacity: 0.9;
}

.hsv-play-button:active {
    transform: translateY(0);
}

.hsv-play-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Icon */
.hsv-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
}

.hsv-icon-play::before {
    content: "▶";
}

.hsv-icon-pause::before {
    content: "⏸";
}

/* Icon Only Style */
.hsv-play-button.hsv-icon-only {
    width: 50px;
    height: 50px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
}

.hsv-play-button.hsv-icon-only .hsv-icon {
    font-size: 18px;
}

/* Button Sizes */
.hsv-size-small .hsv-play-button {
    padding: 8px 16px;
    font-size: 13px;
}

.hsv-size-small .hsv-play-button.hsv-icon-only {
    width: 40px;
    height: 40px;
}

.hsv-size-large .hsv-play-button {
    padding: 16px 32px;
    font-size: 17px;
}

.hsv-size-large .hsv-play-button.hsv-icon-only {
    width: 60px;
    height: 60px;
}

.hsv-size-large .hsv-icon {
    font-size: 20px;
}

/* Player Size Variants */
.hsv-size-small .hsv-audio-player {
    padding: 10px 14px;
    gap: 10px;
}

.hsv-size-small .hsv-play-button-inline {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 12px;
}

.hsv-size-small .hsv-player-title {
    font-size: 12px;
    margin-bottom: 5px;
}

.hsv-size-small .hsv-progress-bar {
    height: 4px;
}

.hsv-size-small .hsv-time-info {
    font-size: 9px;
}

.hsv-size-small .hsv-speed-button {
    padding: 4px 8px;
    font-size: 10px;
}

.hsv-size-large .hsv-audio-player {
    padding: 14px 18px;
    gap: 14px;
}

.hsv-size-large .hsv-play-button-inline {
    width: 48px;
    height: 48px;
    min-width: 48px;
    font-size: 16px;
}

.hsv-size-large .hsv-player-title {
    font-size: 15px;
    margin-bottom: 7px;
}

.hsv-size-large .hsv-progress-bar {
    height: 6px;
    margin-bottom: 5px;
}

.hsv-size-large .hsv-time-info {
    font-size: 11px;
}

.hsv-size-large .hsv-speed-button {
    padding: 6px 12px;
    font-size: 12px;
}

/* ===== PLAYER STYLE ===== */
.hsv-audio-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border: 2px solid #0073aa;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 100%;
}

.hsv-play-button-inline {
    width: 40px;
    height: 40px;
    min-width: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: transparent;
    border: 2px solid #0073aa;
    color: #0073aa;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.hsv-play-button-inline:hover {
    background: #0073aa;
    color: #fff;
}

.hsv-play-button-inline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hsv-player-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.hsv-player-title {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hsv-progress-bar {
    width: 100%;
    height: 5px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    margin-bottom: 4px;
}

.hsv-progress-fill {
    height: 100%;
    background: #0073aa;
    width: 0%;
    transition: width 0.1s linear;
}

.hsv-time-info {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #666;
}

.hsv-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.hsv-speed-button {
    padding: 5px 10px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.hsv-speed-button:hover {
    background: #e0e0e0;
}

/* ===== LOADING STATE ===== */
.hsv-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #666;
    font-size: 14px;
    margin-top: 10px;
}

.hsv-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: hsv-spin 1s linear infinite;
}

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

/* ===== ERROR STATE ===== */
.hsv-error {
    padding: 12px 20px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 6px;
    color: #c33;
    font-size: 14px;
    margin-top: 10px;
}

/* ===== PLAYING STATE ===== */
.hsv-player-wrapper.hsv-playing .hsv-icon-play::before {
    content: "⏸";
}

/* ===== AUDIO ELEMENT ===== */
.hsv-audio-element {
    display: none;
}

/* ===== RESPONSIVE ===== */

/* Tablet (768px - 1024px) */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    .hsv-audio-player {
        padding: 12px 14px;
        gap: 10px;
    }
    
    .hsv-player-title {
        font-size: 12px;
        margin-bottom: 5px;
    }
    
    .hsv-progress-bar {
        height: 4px;
    }
    
    .hsv-time-info {
        font-size: 9px;
    }
    
    .hsv-speed-button {
        padding: 4px 8px;
        font-size: 10px;
    }
}

/* Mobile Landscape & Small Tablet (481px - 768px) */
@media screen and (max-width: 768px) and (min-width: 481px) {
    .hsv-audio-player {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .hsv-play-button-inline {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 12px;
    }
    
    .hsv-player-title {
        font-size: 12px;
        margin-bottom: 5px;
    }
    
    .hsv-progress-bar {
        height: 4px;
        margin-bottom: 3px;
    }
    
    .hsv-time-info {
        font-size: 9px;
    }
    
    .hsv-controls {
        gap: 6px;
    }
    
    .hsv-speed-button {
        padding: 4px 8px;
        font-size: 10px;
    }
}

/* Mobile Portrait (max 480px) */
@media screen and (max-width: 480px) {
    .hsv-player-wrapper {
        margin: 15px 0;
    }
    
    .hsv-audio-player {
        padding: 10px;
        gap: 8px;
        border-width: 1px;
    }
    
    .hsv-play-button-inline {
        width: 34px;
        height: 34px;
        min-width: 34px;
        font-size: 11px;
        border-width: 1.5px;
    }
    
    .hsv-player-title {
        font-size: 11px;
        margin-bottom: 4px;
        line-height: 1.3;
    }
    
    .hsv-progress-bar {
        height: 4px;
        margin-bottom: 3px;
    }
    
    .hsv-time-info {
        font-size: 9px;
    }
    
    .hsv-controls {
        gap: 5px;
    }
    
    .hsv-speed-button {
        padding: 4px 7px;
        font-size: 9px;
        min-width: 32px;
    }
    
    /* Giảm kích thước button thường trên mobile */
    .hsv-play-button {
        padding: 10px 18px;
        font-size: 13px;
        gap: 6px;
    }
    
    .hsv-size-small .hsv-play-button {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .hsv-size-large .hsv-play-button {
        padding: 12px 22px;
        font-size: 14px;
    }
}

/* Mobile Small (max 375px) */
@media screen and (max-width: 375px) {
    .hsv-audio-player {
        padding: 8px;
        gap: 6px;
    }
    
    .hsv-play-button-inline {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 10px;
    }
    
    .hsv-player-title {
        font-size: 10px;
        margin-bottom: 3px;
    }
    
    .hsv-progress-bar {
        height: 3px;
        margin-bottom: 2px;
    }
    
    .hsv-time-info {
        font-size: 8px;
    }
    
    .hsv-speed-button {
        padding: 3px 6px;
        font-size: 9px;
        min-width: 28px;
    }
}

/* Landscape orientation optimization */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .hsv-audio-player {
        padding: 8px 12px;
    }
    
    .hsv-play-button-inline {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
    
    .hsv-player-title {
        font-size: 11px;
        margin-bottom: 3px;
    }
}

/* ===== TOUCH DEVICES OPTIMIZATION ===== */
@media (hover: none) and (pointer: coarse) {
    /* Tăng kích thước touch target cho mobile */
    .hsv-play-button-inline {
        min-width: 44px;
        min-height: 44px;
    }
    
    .hsv-speed-button {
        min-height: 36px;
        min-width: 36px;
    }
    
    .hsv-progress-bar {
        height: 8px; /* Dễ chạm hơn */
        margin: 6px 0;
    }
    
    /* Loại bỏ hover effects trên touch devices */
    .hsv-play-button:hover,
    .hsv-play-button-inline:hover,
    .hsv-speed-button:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* Active state cho touch */
    .hsv-play-button:active {
        opacity: 0.8;
    }
    
    .hsv-play-button-inline:active {
        transform: scale(0.95);
    }
}

/* ===== ACCESSIBILITY ===== */
.hsv-play-button:focus,
.hsv-play-button-inline:focus,
.hsv-speed-button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Ẩn outline khi click bằng chuột */
.hsv-play-button:focus:not(:focus-visible),
.hsv-play-button-inline:focus:not(:focus-visible),
.hsv-speed-button:focus:not(:focus-visible) {
    outline: none;
}

/* ===== ANIMATIONS ===== */
@keyframes hsv-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.hsv-player-wrapper.hsv-loading-audio .hsv-play-button,
.hsv-player-wrapper.hsv-loading-audio .hsv-play-button-inline {
    animation: hsv-pulse 1.5s ease-in-out infinite;
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .hsv-audio-player {
        background: #1e1e1e;
        border-color: #0073aa;
    }
    
    .hsv-player-title {
        color: #fff;
    }
    
    .hsv-time-info {
        color: #aaa;
    }
    
    .hsv-progress-bar {
        background: #333;
    }
    
    .hsv-speed-button {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .hsv-speed-button:hover {
        background: #333;
    }
    
    .hsv-loading {
        background: #2a2a2a;
        border-color: #444;
        color: #aaa;
    }
}

/* ===== RTL SUPPORT ===== */
[dir="rtl"] .hsv-play-button {
    flex-direction: row-reverse;
}

[dir="rtl"] .hsv-audio-player {
    flex-direction: row-reverse;
}

/* ===== PRINT STYLES ===== */
@media print {
    .hsv-player-wrapper {
        display: none;
    }
}

/* ===== UTILITY CLASSES ===== */

/* Compact mode for tight spaces */
.hsv-player-wrapper.hsv-compact .hsv-audio-player {
    padding: 8px 12px;
    gap: 8px;
}

.hsv-player-wrapper.hsv-compact .hsv-play-button-inline {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 11px;
}

.hsv-player-wrapper.hsv-compact .hsv-player-title {
    font-size: 11px;
    margin-bottom: 4px;
}

.hsv-player-wrapper.hsv-compact .hsv-progress-bar {
    height: 3px;
}

.hsv-player-wrapper.hsv-compact .hsv-time-info {
    font-size: 9px;
}

.hsv-player-wrapper.hsv-compact .hsv-speed-button {
    padding: 3px 6px;
    font-size: 9px;
}

/* Full width on mobile */
@media screen and (max-width: 768px) {
    .hsv-audio-player {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Prevent text selection on player controls */
.hsv-audio-player,
.hsv-play-button,
.hsv-play-button-inline,
.hsv-speed-button {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Smooth transitions for all interactive elements */
.hsv-progress-fill,
.hsv-play-button-inline,
.hsv-speed-button {
    will-change: transform, background-color;
}

/* Performance optimization */
.hsv-audio-player {
    contain: layout style;
}


