/**
 * Advanced TTS Pro - Frontend Styles
 * Professional text-to-speech player controls
 */

/* Container */
.atts-controls {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    box-sizing: border-box;
}

/* Position variants */
.atts-position-top {
    margin-bottom: 30px;
}

.atts-position-bottom {
    margin-top: 30px;
}

.atts-position-floating {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    max-width: 600px;
}

.atts-position-inline {
    display: inline-block;
}

/* Buttons wrapper */
.atts-buttons-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

/* Button base styles */
.atts-btn {
    background-color: #000000;
    color: #ffffff;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    outline: none;
    white-space: nowrap;
}

.atts-btn:hover {
    background-color: #333333;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.atts-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.atts-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.atts-btn.loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: atts-spin 0.6s linear infinite;
    display: inline-block;
    margin-left: 8px;
}

@keyframes atts-spin {
    to { transform: rotate(360deg); }
}

/* Icon styles */
.atts-icon {
    font-size: 1.2em;
    line-height: 1;
}

.atts-text {
    font-weight: 500;
}

/* Button style variants */
.atts-controls.style-square .atts-btn {
    border-radius: 4px;
}

.atts-controls.style-pill .atts-btn {
    border-radius: 50px;
    padding: 10px 24px;
}

.atts-controls.style-minimal .atts-btn {
    background-color: transparent;
    color: #000000;
    border: 2px solid #000000;
}

.atts-controls.style-minimal .atts-btn:hover {
    background-color: #000000;
    color: #ffffff;
}

/* Voice selector */
.atts-voice-selector {
    margin-top: 10px;
}

.atts-voice-select {
    padding: 8px 12px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-size: 0.95em;
    background: #ffffff;
    cursor: pointer;
    min-width: 200px;
}

.atts-voice-select:focus {
    outline: none;
    border-color: #0366d6;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

/* Speed control */
.atts-speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.atts-speed-control label {
    font-size: 0.9em;
    color: #586069;
    white-space: nowrap;
}

.atts-speed-slider {
    flex: 1;
    max-width: 150px;
    cursor: pointer;
}

.atts-speed-value {
    font-weight: 600;
    color: #000000;
}

/* Timer */
.atts-timer {
    text-align: center;
    font-size: 1.1em;
    color: #24292e;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    margin-bottom: 10px;
}

.atts-separator {
    margin: 0 5px;
    color: #959da5;
}

/* Progress bar */
.atts-progress-bar-container {
    width: 100%;
    margin-top: 10px;
}

.atts-progress-bar {
    width: 100%;
    height: 6px;
    background: #e1e4e8;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.atts-progress-bar:hover {
    height: 8px;
}

.atts-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0366d6 0%, #00a8ff 100%);
    border-radius: 3px;
    transition: width 0.1s linear;
    position: relative;
}

.atts-progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: #ffffff;
    border: 2px solid #0366d6;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.atts-progress-bar:hover .atts-progress-fill::after {
    opacity: 1;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .atts-controls {
        padding: 15px;
        margin: 15px auto;
    }

    .atts-position-floating {
        left: 10px;
        right: 10px;
        transform: none;
        max-width: none;
        bottom: 10px;
    }

    .atts-buttons-wrapper {
        gap: 8px;
    }

    .atts-btn {
        padding: 12px 18px;
        font-size: 0.95em;
    }

    .atts-btn .atts-text {
        display: none;
    }

    .atts-btn .atts-icon {
        font-size: 1.4em;
    }

    .atts-timer {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .atts-controls {
        padding: 12px;
    }

    .atts-btn {
        padding: 10px 14px;
    }

    .atts-voice-selector,
    .atts-speed-control {
        width: 100%;
    }

    .atts-voice-select {
        width: 100%;
        min-width: auto;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .atts-controls {
        background: #1c1c1e;
        border-color: #38383a;
    }

    .atts-timer {
        color: #ffffff;
    }

    .atts-voice-select {
        background: #2c2c2e;
        color: #ffffff;
        border-color: #38383a;
    }

    .atts-progress-bar {
        background: #38383a;
    }

    .atts-speed-control label {
        color: #98989f;
    }

    .atts-speed-value {
        color: #ffffff;
    }
}

/* Accessibility */
.atts-btn:focus-visible {
    outline: 2px solid #0366d6;
    outline-offset: 2px;
}

.atts-controls *:focus {
    outline-color: #0366d6;
}

/* Loading state */
.atts-controls.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Text highlight (for read-along feature) */
.atts-highlight {
    background-color: #ffeb3b !important;
    color: #000000 !important;
    padding: 3px 5px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    transition: none !important;
    display: inline !important;
}

/* Print styles */
@media print {
    .atts-controls {
        display: none;
    }
}

/* Animation for appearing */
@keyframes atts-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.atts-controls {
    animation: atts-fadeIn 0.3s ease-out;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .atts-btn {
        border: 2px solid currentColor;
    }

    .atts-progress-bar {
        border: 1px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .atts-controls,
    .atts-btn,
    .atts-progress-fill,
    .atts-highlight {
        animation: none;
        transition: none;
    }
}
