/**
 * Blind Reader Plugin Styles
 * 
 * Professional stylesheet with accessibility features, vendor prefixes,
 * and CSS variables for maintainability.
 * 
 * @package BlindReader
 * @version 1.5
 * @author Antigravity
 */

/* ============================================
   CSS Variables (Custom Properties)
   ============================================ */
:root {
    /* Colors */
    --blind-reader-primary: #0073aa;
    --blind-reader-primary-hover: #005177;
    --blind-reader-bg: #f0f0f0;
    --blind-reader-text: #ffffff;
    --blind-reader-focus: #000000;

    /* Spacing */
    --blind-reader-spacing-sm: 5px;
    --blind-reader-spacing-md: 10px;
    --blind-reader-spacing-lg: 15px;
    --blind-reader-spacing-xl: 20px;

    /* Border Radius */
    --blind-reader-radius-sm: 4px;
    --blind-reader-radius-md: 5px;

    /* Font Sizes */
    --blind-reader-font-base: 16px;

    /* Transitions */
    --blind-reader-transition: all 0.3s ease;
}

/* ============================================
   Control Container
   ============================================ */
.blind-reader-controls {
    margin-bottom: var(--blind-reader-spacing-xl);
    /* Force transparent background and remove borders/shadows */
    background: transparent !important;
    background-color: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    display: flex;
    /* Vendor prefixes for older browsers */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: var(--blind-reader-spacing-md);
    /* Fallback for browsers without gap support */
    flex-wrap: wrap;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -ms-flex-direction: row;
    flex-direction: row;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    /* Align to left */
    -webkit-box-pack: start;
    -ms-flex-pack: start;
    justify-content: flex-start;
}

/* Responsive: Keep horizontal on mobile */
@media (max-width: 768px) {
    .blind-reader-controls {
        /* Force horizontal row */
        -webkit-box-orient: horizontal;
        -webkit-box-direction: normal;
        -ms-flex-direction: row;
        flex-direction: row;
        /* Align left */
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        -webkit-box-pack: start;
        -ms-flex-pack: start;
        justify-content: flex-start;
    }
}

/* ============================================
   Buttons
   ============================================ */
.blind-reader-btn {
    background-color: var(--blind-reader-primary);
    color: var(--blind-reader-text);
    border: none;
    padding: var(--blind-reader-spacing-md) var(--blind-reader-spacing-lg);
    border-radius: var(--blind-reader-radius-sm);
    cursor: pointer;
    font-size: var(--blind-reader-font-base);
    display: flex;
    /* Vendor prefixes */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: var(--blind-reader-spacing-sm);
    /* Transitions for smooth effects */
    -webkit-transition: var(--blind-reader-transition);
    -o-transition: var(--blind-reader-transition);
    transition: var(--blind-reader-transition);
    /* Accessibility: Prevent text selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Remove default button styles */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Ensure readable text */
    font-weight: 500;
    line-height: 1.5;
}

/* Auto-size on mobile (not full width) */
@media (max-width: 768px) {
    .blind-reader-btn {
        width: auto;
    }
}

/* ============================================
   Button States
   ============================================ */

/* Hover state */
.blind-reader-btn:hover {
    background-color: var(--blind-reader-primary-hover);
    -webkit-transform: translateY(-1px);
    -ms-transform: translateY(-1px);
    transform: translateY(-1px);
    -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

/* Active/Pressed state */
.blind-reader-btn:active {
    -webkit-transform: translateY(0);
    -ms-transform: translateY(0);
    transform: translateY(0);
    -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Focus state - Essential for accessibility */
.blind-reader-btn:focus {
    outline: 2px solid var(--blind-reader-focus);
    outline-offset: 2px;
    /* Vendor prefix for outline-offset */
    -webkit-box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.2);
    box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.2);
}

/* Focus visible (modern browsers) - Only show focus on keyboard navigation */
.blind-reader-btn:focus-visible {
    outline: 2px solid var(--blind-reader-focus);
    outline-offset: 2px;
}

/* Remove focus outline for mouse clicks only */
.blind-reader-btn:focus:not(:focus-visible) {
    outline: none;
    -webkit-box-shadow: none;
    box-shadow: none;
}

/* Disabled state */
.blind-reader-btn:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    opacity: 0.6;
    -webkit-transform: none;
    -ms-transform: none;
    transform: none;
}

/* ============================================
   Accessibility Features
   ============================================ */

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .blind-reader-controls {
        border: 2px solid currentColor;
    }

    .blind-reader-btn {
        border: 2px solid var(--blind-reader-text);
    }
}

/* Reduced Motion Support - Respect user preferences */
@media (prefers-reduced-motion: reduce) {
    .blind-reader-btn {
        -webkit-transition: none;
        -o-transition: none;
        transition: none;
        -webkit-transform: none !important;
        -ms-transform: none !important;
        transform: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --blind-reader-bg: #2a2a2a;
        --blind-reader-focus: #ffffff;
    }

    .blind-reader-controls {
        /* No background in dark mode either as requested */
        background: transparent !important;
        color: #ffffff;
    }
}

/* ============================================
   Print Styles - Hide controls when printing
   ============================================ */
@media print {
    .blind-reader-controls {
        display: none !important;
    }
}

/* ============================================
   RTL (Right-to-Left) Language Support
   ============================================ */
[dir="rtl"] .blind-reader-controls {
    -webkit-box-orient: horizontal;
    -webkit-box-direction: reverse;
    -ms-flex-direction: row-reverse;
    flex-direction: row-reverse;
}

/* ============================================
   Loading State (for future enhancements)
   ============================================ */
.blind-reader-btn.is-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.blind-reader-btn.is-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    -webkit-animation: blind-reader-spin 0.8s linear infinite;
    animation: blind-reader-spin 0.8s linear infinite;
}

@-webkit-keyframes blind-reader-spin {
    to {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}

@keyframes blind-reader-spin {
    to {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}