/* WP Accessibility Tool Pro - Frontend Styles */

/* Toolbar Styles */
.wpatp-toolbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.wpatp-toolbar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.wpatp-tool-group {
    position: relative;
}

/* Button Styles */
.wpatp-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wpatp-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.wpatp-btn:active {
    transform: translateY(0);
}

.wpatp-btn:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

/* Button Icons - Simple styling for emoji icons */
.wpatp-icon-language,
.wpatp-icon-speaker,
.wpatp-icon-explain,
.wpatp-icon-simplify,
.wpatp-icon-help {
    display: inline-block;
    font-size: 16px;
    line-height: 1;
    margin-right: 5px;
}

.wpatp-current-lang {
    background: #4A90E2;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 5px;
}

/* Dropdown Styles */
.wpatp-dropdown {
    position: relative;
}

.wpatp-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1001;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 5px;
}

.wpatp-dropdown-menu.active {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.wpatp-dropdown-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    gap: 10px;
    transition: background-color 0.2s ease;
}

.wpatp-dropdown-item:hover {
    background-color: #f5f5f5;
}

.wpatp-dropdown-item:focus {
    background-color: #e3f2fd;
    outline: none;
}

/* Flag Icons */
.wpatp-flag {
    width: 20px;
    height: 15px;
    background-size: cover;
    border-radius: 2px;
    display: inline-block;
}

.wpatp-flag-nl { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="9" height="6"><rect width="9" height="2" fill="%23AE1C34"/><rect y="2" width="9" height="2" fill="white"/><rect y="4" width="9" height="2" fill="%2321468B"/></svg>'); }
.wpatp-flag-en { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6"><rect width="12" height="6" fill="%23012169"/><path d="m0,0 L12,6 M12,0 L0,6" stroke="white" stroke-width="0.6"/><path d="m0,0 L12,6 M12,0 L0,6" stroke="%23C8102E" stroke-width="0.4"/><rect width="12" height="0.6" y="2.7" fill="white"/><rect width="0.6" height="6" x="5.7" fill="white"/><rect width="12" height="0.4" y="2.8" fill="%23C8102E"/><rect width="0.4" height="6" x="5.8" fill="%23C8102E"/></svg>'); }
.wpatp-flag-de { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="9" height="6"><rect width="9" height="2" fill="black"/><rect y="2" width="9" height="2" fill="%23DD003F"/><rect y="4" width="9" height="2" fill="%23FFCE00"/></svg>'); }
.wpatp-flag-fr { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="9" height="6"><rect width="3" height="6" fill="%23002A8F"/><rect x="3" width="3" height="6" fill="white"/><rect x="6" width="3" height="6" fill="%23EF3B2C"/></svg>'); }
.wpatp-flag-es { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="9" height="6"><rect width="9" height="1.5" fill="%23AA151B"/><rect y="1.5" width="9" height="3" fill="%23F1BF00"/><rect y="4.5" width="9" height="1.5" fill="%23AA151B"/></svg>'); }
.wpatp-flag-it { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="9" height="6"><rect width="3" height="6" fill="%23009246"/><rect x="3" width="3" height="6" fill="white"/><rect x="6" width="3" height="6" fill="%23CE2B37"/></svg>'); }
.wpatp-flag-pt { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="9" height="6"><rect width="3.6" height="6" fill="%23046A38"/><rect x="3.6" width="5.4" height="6" fill="%23DA020E"/></svg>'); }
.wpatp-flag-ru { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="9" height="6"><rect width="9" height="2" fill="white"/><rect y="2" width="9" height="2" fill="%23D52B1E"/><rect y="4" width="9" height="2" fill="%230039A6"/></svg>'); }
.wpatp-flag-zh { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="9" height="6"><rect width="9" height="6" fill="%23DE2910"/><polygon points="1.5,1 2,0.5 2.5,1 2.3,1.5 1.7,1.5" fill="%23FFDE00"/></svg>'); }
.wpatp-flag-ja { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="9" height="6"><rect width="9" height="6" fill="white"/><circle cx="4.5" cy="3" r="1.8" fill="%23BC002D"/></svg>'); }
.wpatp-flag-ko { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="9" height="6"><rect width="9" height="6" fill="white"/><circle cx="4.5" cy="3" r="1.2" fill="%23C60C30"/><circle cx="4.5" cy="3" r="0.6" fill="%23003478"/></svg>'); }
.wpatp-flag-ar { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="9" height="6"><rect width="9" height="2" fill="%23CE1126"/><rect y="2" width="9" height="2" fill="white"/><rect y="4" width="9" height="2" fill="black"/></svg>'); }

/* Overlay and Popup Styles */
.wpatp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.wpatp-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: popupAppear 0.3s ease-out;
}

@keyframes popupAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
        scale: 0.9;
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
        scale: 1;
    }
}

.wpatp-popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 25px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.wpatp-popup-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    flex: 1;
}

/* TTS Controls */
.wpatp-tts-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.wpatp-control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    min-width: 40px;
    justify-content: center;
}

.wpatp-control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.wpatp-control-btn:active {
    transform: translateY(0);
}

.wpatp-control-btn.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Font Controls */
.wpatp-font-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.wpatp-font-btn {
    width: 32px;
    height: 32px;
    font-weight: bold;
    border-radius: 4px;
}

.wpatp-font-btn[data-size="small"] { font-size: 12px; }
.wpatp-font-btn[data-size="medium"] { font-size: 16px; }
.wpatp-font-btn[data-size="large"] { font-size: 20px; }

/* Control Icons */
.wpatp-icon-play::before { content: "&#9654;"; }
.wpatp-icon-pause::before { content: "&#9208;"; }
.wpatp-icon-rewind::before { content: "&#9194;"; }
.wpatp-icon-forward::before { content: "&#9193;"; }
.wpatp-icon-close::before { content: "&#10005;"; }

.wpatp-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
}

.wpatp-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Popup Content */
.wpatp-popup-content {
    padding: 25px;
    max-height: calc(80vh - 120px);
    overflow-y: auto;
    line-height: 1.6;
}

.wpatp-content-area {
    font-size: 16px;
    color: #333;
}

.wpatp-content-area.font-small { font-size: 15px; }
.wpatp-content-area.font-medium { font-size: 24px; }
.wpatp-content-area.font-large { font-size: 36px; }

/* Loading Animation */
.wpatp-loading {
    text-align: center;
    padding: 40px 20px;
}

.wpatp-spinner {
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    border-top: 4px solid #667eea;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Word Explanation Styles */
.wpatp-difficult-word {
    background: linear-gradient(120deg, #FFEAA7 0%, #FDCB6E 100%);
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px dashed #E17055;
    display: inline;
    position: relative;
}

.wpatp-difficult-word:hover {
    background: linear-gradient(120deg, #FDCB6E 0%, #E17055 100%);
    color: white;
    transform: scale(1.05);
}

.wpatp-word-explanation {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 15px 20px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wpatp-word-explanation strong {
    color: #667eea;
    display: block;
    margin-bottom: 8px;
    font-size: 18px;
}

/* TTS Highlighting */
.wpatp-current-word {
    background: linear-gradient(120deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    padding: 2px 4px;
    border-radius: 4px;
    animation: pulse 0.8s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Simplified Text Styles */
.wpatp-simplified-text ul {
    list-style: none;
    padding: 0;
}

/* Simplified Text Styles */
.wpatp-simplified-text ul {
    list-style: none;
    padding: 0;
}

.wpatp-simplified-text li {
    background: #f8f9fa;
    margin: 10px 0;
    padding: 15px 20px;
    border-left: 4px solid #28a745;
    border-radius: 0 8px 8px 0;
    position: relative;
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
    transform: translateY(20px);
    font-size: 16px;
    line-height: 1.5;
}

.wpatp-simplified-text li:nth-child(1) { animation-delay: 0.1s; }
.wpatp-simplified-text li:nth-child(2) { animation-delay: 0.2s; }
.wpatp-simplified-text li:nth-child(3) { animation-delay: 0.3s; }
.wpatp-simplified-text li:nth-child(4) { animation-delay: 0.4s; }
.wpatp-simplified-text li:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wpatp-simplified-text li::before {
    content: "&#10003;";
    color: #28a745;
    font-weight: bold;
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    padding: 2px 6px;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    border: 2px solid #28a745;
}

/* FAQ Styles */
.wpatp-faq-list {
    padding: 0;
    list-style: none;
}

.wpatp-faq-item {
    margin-bottom: 15px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.wpatp-faq-item:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.wpatp-faq-question {
    background: #f8f9fa;
    padding: 20px;
    margin: 0;
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.wpatp-faq-question:hover {
    background: #e9ecef;
}

.wpatp-faq-question::after {
    content: "+";
    font-size: 20px;
    color: #667eea;
    transition: transform 0.2s ease;
}

.wpatp-faq-question.active::after {
    transform: rotate(45deg);
}

.wpatp-faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    background: white;
}

.wpatp-faq-answer.active {
    padding: 20px;
    max-height: 200px;
}

/* Error States */
.wpatp-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin: 15px 0;
}

.wpatp-error::before {
    content: "&#9888; ";
    font-weight: bold;
}

/* Success States */
.wpatp-success {
    background: #d4edda;
    color: #155724;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #c3e6cb;
    margin: 15px 0;
}

.wpatp-success::before {
    content: "&#10003; ";
    font-weight: bold;
}

/* Scrollbar Styles */
.wpatp-popup-content::-webkit-scrollbar {
    width: 8px;
}

.wpatp-popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.wpatp-popup-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

.wpatp-popup-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* Accessibility Features */
.wpatp-visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

.wpatp-high-contrast {
    filter: contrast(150%);
}

/* Focus States for Better Accessibility */
.wpatp-btn:focus-visible,
.wpatp-control-btn:focus-visible,
.wpatp-dropdown-item:focus-visible,
.wpatp-close-btn:focus-visible {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .wpatp-popup,
    .wpatp-dropdown-menu,
    .wpatp-word-explanation,
    .wpatp-simplified-text li,
    .wpatp-current-word,
    .wpatp-btn,
    .wpatp-control-btn {
        animation: none !important;
        transition: none !important;
    }
}

/* Print Styles */
@media print {
    .wpatp-toolbar,
    .wpatp-overlay,
    .wpatp-popup {
        display: none !important;
    }
}