/* Read Aloud Widget Styles */
.read-aloud-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background: white;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.read-aloud-widget.collapsed {
    width: 60px;
    height: 60px;
}

.read-aloud-widget.expanded {
    width: 300px;
    min-height: 60px;
}

.btn-read-aloud {
    width: 60px;
    height: 60px;
    border: none;
    background: linear-gradient(135deg, #198754, #157347);
    color: white;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-read-aloud:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(25, 135, 84, 0.4);
}

.player-controls {
    padding: 15px;
    display: none;
}

.player-controls.show {
    display: block;
}

.control-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.control-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f8f9fa;
    color: #198754;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: #198754;
    color: white;
}

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

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.speed-control select {
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 5px 10px;
    background: white;
}

.progress-container {
    margin-top: 10px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #198754;
    width: 0%;
    transition: width 0.3s ease;
}

.current-sentence {
    margin-top: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 12px;
    color: #495057;
    max-height: 60px;
    overflow-y: auto;
}

.voice-selection {
    margin-top: 10px;
}

.voice-selection select {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 5px 10px;
    background: white;
}

/* Text highlighting */
.highlighted-text {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Loading & Status Indicators */
.loading-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #198754;
}

.status-indicator {
    margin-left: auto;
}

.status-text {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-ready {
    background: #e7f4e4;
    color: #198754;
}

.status-loading {
    background: #fff3cd;
    color: #856404;
}

.status-playing {
    background: #d1ecf1;
    color: #0c5460;
}

.status-paused {
    background: #f8d7da;
    color: #721c24;
}

.progress-text {
    display: block;
    text-align: center;
    margin-top: 5px;
    font-size: 10px;
    color: #6c757d;
}

/* Spinner animation */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Button states */
.control-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.control-btn.loading i {
    animation: spin 1s linear infinite;
}

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


/* ✅ RESPONSIVE FIXED */
@media (max-width: 768px) {
    .read-aloud-widget {
        bottom: 40px !important;    /* ⬅️ PASTIKAN di bawah */
        left: 10px !important;      /* ⬅️ PASTIKAN di kiri */
        top: auto !important;       /* ⬅️ HAPUS top */
        right: auto !important;     /* ⬅️ HAPUS right */
    }
    
    .read-aloud-widget.expanded {
        width: calc(100vw - 40px);
        left: 20px;
        right: auto;                /* ⬅️ RESET right */
        bottom: 40px !important;    /* ⬅️ TETAP di bawah */
    }
    
    /* Optional: Perkecil sedikit untuk mobile */
    .read-aloud-widget.collapsed {
        width: 50px;
        height: 50px;
    }
    
    .btn-read-aloud {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
}