/* Extended styles for FreeGuitarTuner - Lazy loaded */

/* String button interactions */
.string-button:hover {
    background-color: var(--button-bg-hover);
    box-shadow: 0 6px 18px rgba(0,0,0,0.6), 0 2px 6px rgba(0,0,0,0.4);
    transform: translateY(-1px);
}

.string-button:active {
    transform: scale(0.96) translateY(0);
    box-shadow: 0 3px 8px rgba(0,0,0,0.5);
}

.string-button.active {
    background-color: var(--accent-color);
    color: var(--bg-color);
    box-shadow: 0 6px 18px rgba(11, 132, 255, 0.7), 0 0 30px rgba(11, 132, 255, 0.3);
}

.string-button.perfect {
    background-color: var(--perfect-color);
    color: var(--bg-color);
    box-shadow: 0 6px 18px rgba(48, 209, 88, 0.7), 0 0 30px rgba(48, 209, 88, 0.3);
}

/* Start button interactions */
#start-button:hover {
    background-color: var(--button-bg-hover);
    box-shadow: 0 8px 20px rgba(0,0,0,0.7), 0 4px 10px rgba(0,0,0,0.5);
    transform: translateY(-2px);
}

#start-button:active {
    transform: scale(0.98) translateY(0);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

#start-button.active {
    background-color: #ff3b30;
    color: white;
    box-shadow: 0 8px 20px rgba(255, 59, 48, 0.7), 0 0 40px rgba(255, 59, 48, 0.4);
}

/* Tuning status and messaging */
#tuning-status {
    font-size: 0.9rem;
    color: var(--text-secondary);
    min-height: 1.2em;
}

#initial-message {
    color: var(--text-secondary);
    margin-top: 1rem;
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    min-height: 1.5em; /* Reserve space to prevent layout shift */
    transition: opacity 0.2s ease; /* Smooth fade transition */
}

#initial-message.hidden {
    opacity: 0; /* Fade out instead of display:none */
    pointer-events: none; /* Prevent interaction when hidden */
}

/* Dropdown interactions */
#tuning-select:hover {
    background-color: var(--button-bg-hover);
    border-color: var(--text-secondary);
    box-shadow: 0 6px 18px rgba(0,0,0,0.6), 0 2px 6px rgba(0,0,0,0.4);
    transform: translateY(-1px);
}

#tuning-select option {
    background-color: var(--button-bg);
    color: var(--text-color);
}

/* Labels and instructions */
#tone-indicator-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    margin-top: 2rem;
}

/* Footer styles */
#app-footer {
    width: 100%;
    padding: 0 1rem;
    margin-top: auto;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.footer-links {
    margin-bottom: 0.3rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: underline;
    margin: 0 0.3rem;
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.footer-links a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.footer-links a:active {
    color: var(--accent-color);
}

.link-separator {
    margin: 0 0.2rem;
}

.privacy-notice {
    line-height: 1.4;
}

/* Enhanced tuning visual feedback animations */
@keyframes pulse-perfect {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.string-button.perfect {
    animation: pulse-perfect 2s ease-in-out infinite;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .string-button.perfect {
        animation: none;
    }
    
    .string-button,
    #start-button,
    #tuning-indicator,
    #indicator-arm {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg-color: #000000;
        --text-color: #ffffff;
        --text-secondary: #cccccc;
        --accent-color: #0099ff;
        --button-bg: #333333;
        --meter-track-color: #555555;
    }
}

/* Dark mode refinements */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #000000;
        --text-color: #ffffff;
        --text-secondary: #999999;
    }
}

/* Additional accessibility improvements */
@media (prefers-reduced-motion: no-preference) {
    .string-button {
        transition: background-color 0.2s ease, transform 0.1s ease;
    }
    
    #start-button {
        transition: background-color 0.2s ease, transform 0.1s ease;
    }
}

/* Focus indicators for keyboard navigation */
.string-button:focus-visible,
#start-button:focus-visible,
#tuning-select:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Improved touch targets for mobile accessibility */
@media (hover: none) and (pointer: coarse) {
    .string-button {
        min-width: 48px;
        min-height: 48px;
    }

    #start-button {
        min-height: 48px;
    }
}

/* FAQ Section Styles */
#faq-section {
    width: 100%;
    max-width: 600px;
    margin: 0.5rem auto 0.5rem;
    padding: 0 1rem;
}

.faq-item {
    background-color: var(--button-bg);
    border-radius: 12px;
    margin-bottom: 0.5rem;
    padding: 0;
    border: 1px solid var(--meter-track-color);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.faq-item:hover {
    background-color: var(--button-bg-hover);
    border-color: var(--text-secondary);
}

.faq-item summary {
    padding: 0.85rem 1.15rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
    list-style: none;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    padding: 0 1.15rem 1rem 1.15rem;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.faq-item summary:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Compact FAQ on smaller screens */
@media (max-height: 700px) {
    #faq-section {
        margin: 0.5rem auto 0.5rem;
        max-width: 500px;
    }

    .faq-item {
        margin-bottom: 0.5rem;
    }

    .faq-item summary {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .faq-item p {
        padding: 0 1rem 1rem 1rem;
        font-size: 0.85rem;
    }
}

@media (max-height: 900px) {
    #faq-section {
        margin: 0.75rem auto 0.75rem;
    }

    .faq-item {
        margin-bottom: 0.6rem;
    }
}

/* RTL (Right-to-Left) Support for Arabic */
[dir="rtl"] {
    direction: rtl;
}

[dir="rtl"] body {
    text-align: right;
}

[dir="rtl"] #app-footer {
    direction: rtl;
    text-align: center;
}

[dir="rtl"] .footer-links {
    direction: rtl;
}

[dir="rtl"] #pitch-info {
    flex-direction: row-reverse;
}

[dir="rtl"] .faq-item summary {
    flex-direction: row-reverse;
}

[dir="rtl"] .lang-switcher {
    direction: rtl;
}

/* Language Switcher in Footer */
.lang-switcher-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
}

.lang-link {
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--text-color);
    opacity: 0.6;
    transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
    cursor: pointer;
    display: inline-block;
}

.lang-link:hover {
    opacity: 0.9;
    color: var(--accent-color);
    transform: translateY(-1px);
}

.lang-link.active {
    opacity: 1;
    color: var(--text-color);
    font-weight: 600;
}

@media (max-width: 600px) {
    .lang-link {
        font-size: 0.85rem;
    }
}