/**
 * Read Aloud - Text-to-Speech Controls Styling
 * Matches the holographic minimalism / glass morphism design
 */

/* Main controls container */
.read-aloud-controls {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin: 1.5rem 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-soft);
    transition: all var(--transition-base);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.read-aloud-controls:hover {
    border-color: var(--accent-cyan);
    box-shadow: var(--shadow-glow-blue);
}

/* Header */
.read-aloud-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-primary);
}

.read-aloud-icon {
    font-size: 1rem;
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        filter: drop-shadow(0 0 4px rgba(2, 84, 122, 0.4));
    }
    50% {
        opacity: 0.8;
        filter: drop-shadow(0 0 8px rgba(2, 84, 122, 0.6));
    }
}

.read-aloud-title {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Button controls */
.read-aloud-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.read-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 0;
    flex-shrink: 0;
}

.read-btn:hover:not(:disabled) {
    background: var(--bg-surface);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 84, 122, 0.3);
}

.read-btn:active:not(:disabled) {
    transform: translateY(0);
}

.read-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.read-btn-primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.read-btn-primary:hover:not(:disabled) {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 127, 32, 0.4);
}

.read-btn svg {
    width: 14px;
    height: 14px;
}

/* Settings */
.read-aloud-settings {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.read-setting-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.read-setting-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.read-select {
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-base);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239898a6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    padding-right: 2rem;
    min-width: 80px;
}

.read-select:hover {
    border-color: var(--accent-cyan);
    background-color: var(--bg-surface);
}

.read-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(2, 84, 122, 0.2);
}

.read-select option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* Progress bar */
.read-progress-bar {
    flex: 1;
    min-width: 120px;
    height: 3px;
    background: var(--bg-elevated);
    border-radius: 1.5px;
    overflow: hidden;
    position: relative;
}

.read-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
    border-radius: 1.5px;
    transition: width 0.3s ease;
    position: relative;
}

.read-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Text highlighting */
.read-aloud-highlight {
    background: linear-gradient(90deg, rgba(2, 84, 122, 0.15), rgba(245, 127, 32, 0.08));
    border-left: 3px solid var(--accent-cyan);
    padding-left: 1rem !important;
    margin-left: -1rem !important;
    border-radius: 4px;
    transition: all var(--transition-base);
    box-shadow: 0 0 20px rgba(2, 84, 122, 0.2);
}

/* Responsive design - 3 rows for mobile */
@media (max-width: 768px) {
    .read-aloud-controls {
        padding: 0.75rem 0.875rem;
        gap: 0.75rem;
    }

    /* Row 1: Header + Buttons */
    .read-aloud-header {
        width: 100%;
        justify-content: space-between;
        order: 1;
    }

    .read-aloud-buttons {
        order: 2;
        width: auto;
        margin-left: auto;
    }

    /* Row 2: Settings */
    .read-aloud-settings {
        order: 3;
        width: 100%;
        justify-content: space-between;
    }

    .read-setting-group {
        flex: 1;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.375rem;
    }

    .read-select {
        width: 100%;
        min-width: unset;
    }

    /* Row 3: Progress bar */
    .read-progress-bar {
        order: 4;
        width: 100%;
        min-width: unset;
    }

    .read-btn {
        width: 34px;
        height: 34px;
    }

    .read-btn svg {
        width: 12px;
        height: 12px;
    }
}

/* Accessibility - Focus states */
.read-btn:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Loading state (for voices loading) */
.read-aloud-controls.loading .read-btn {
    pointer-events: none;
    opacity: 0.6;
}

.read-aloud-controls {
    position: relative;
}

/* Dark mode enhancement (if needed) */
@media (prefers-color-scheme: dark) {
    .read-aloud-controls {
        /* Already optimized for dark theme */
    }
}

/* Print - hide controls */
@media print {
    .read-aloud-controls {
        display: none !important;
    }
}
