/* Injoy Hearing Test Styles */
#injoy-hearing-test-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8fafc;
    border-radius: 12px;
    overflow: visible;
    position: relative;
    min-height: 600px;
    max-width: 800px;
    margin: 0 auto;
}

.injoy-screen {
    display: none;
    padding: 2rem;
    min-height: auto;
}

.injoy-screen.active {
    display: block;
}

.injoy-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    padding: 2.5rem;
    max-width: 700px;
    margin: 0 auto;
    border: 1px solid #e2e8f0;
}

.injoy-header {
    margin-bottom: 2rem;
    text-align: center;
}

.injoy-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.injoy-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #045e87 0%, #0891b2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
}

.injoy-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    letter-spacing: -0.025em;
}

.injoy-subtitle {
    color: #64748b;
    margin: 0.75rem 0 0 0;
    font-size: 1.125rem;
    font-weight: 400;
}

.injoy-steps {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.injoy-steps li {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.injoy-steps li:hover {
    background-color: #f8fafc;
}

.injoy-duration {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.injoy-btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    letter-spacing: 0.025em;
}

.injoy-btn-primary {
    background: linear-gradient(135deg, #045e87 0%, #0891b2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(4, 94, 135, 0.3);
}

.injoy-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #034a6b 0%, #0e7490 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(4, 94, 135, 0.4);
}

.injoy-btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.injoy-btn-secondary {
    background: white;
    color: #475569;
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.injoy-btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.injoy-btn-round {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 1.25rem;
    padding: 0;
    background: linear-gradient(135deg, #045e87 0%, #0891b2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(4, 94, 135, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.injoy-btn-round:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(4, 94, 135, 0.4);
}

.injoy-btn-test {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    font-size: 1.5rem;
    padding: 0;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    margin: 1.5rem 0;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.injoy-btn-test:hover {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.injoy-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.injoy-progress-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.injoy-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.injoy-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.injoy-step.active .injoy-step-number {
    background: #045e87;
    color: white;
}

.injoy-step.completed .injoy-step-number {
    background: #10b981;
    color: white;
}

.injoy-step-line {
    width: 60px;
    height: 2px;
    background: #e5e7eb;
    margin: 0 1rem;
}

.injoy-step-line.completed {
    background: #10b981;
}

.injoy-info-box {
    background: #f0f9ff;
    border: 2px solid #7dd3fc;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.injoy-info-box h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0c4a6e;
    margin: 0 0 1rem 0;
}

.injoy-info-box ol, .injoy-info-box ul {
    margin: 0;
    padding-left: 1.25rem;
}

.injoy-info-box li {
    margin-bottom: 0.5rem;
    color: #475569;
    line-height: 1.5;
}

.injoy-calibration-button {
    text-align: center;
    margin: 2rem 0;
}

.injoy-calibration-text {
    text-align: center;
    color: #6b7280;
    margin: 1rem 0;
}

.injoy-test-controls {
    text-align: center;
}

.injoy-volume-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    justify-content: center;
}

.injoy-slider {
    width: 200px;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
}

.injoy-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #045e87;
    cursor: pointer;
}

.injoy-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #045e87;
    cursor: pointer;
    border: none;
}

.injoy-progress {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.injoy-progress-bar {
    height: 100%;
    background: #10b981;
    transition: width 0.3s ease;
}

.injoy-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.injoy-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #045e87;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.injoy-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.injoy-summary-item {
    text-align: center;
    padding: 1.5rem;
    border-radius: 12px;
    background: white;
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.injoy-summary-item h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    margin: 0 0 0.75rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.injoy-threshold-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.5rem;
    letter-spacing: -0.025em;
}

.injoy-threshold-value.normal {
    color: #059669;
}

.injoy-threshold-value.mild {
    color: #d97706;
}

.injoy-threshold-value.moderate {
    color: #dc2626;
}

.injoy-threshold-value.severe {
    color: #991b1b;
}

.injoy-chart {
    margin: 2rem 0;
    text-align: center;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

#audiogram-canvas {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    max-width: 100%;
    width: 100%;
    height: 300px;
    background: white;
}

.injoy-recommendations {
    margin: 2rem 0;
}

.injoy-recommendation {
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 2px solid;
}

.injoy-recommendation.normal {
    background: #f0fdf4;
    border-color: #22c55e;
}

.injoy-recommendation.mild {
    background: #fffbeb;
    border-color: #f59e0b;
}

.injoy-recommendation.moderate {
    background: #fef2f2;
    border-color: #ef4444;
}

.injoy-recommendation h4 {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

.injoy-recommendation ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.injoy-recommendation li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.injoy-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Contact Form Styles */
.injoy-contact-form {
    max-width: 600px;
    margin: 0 auto;
}

.injoy-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.injoy-form-group {
    display: flex;
    flex-direction: column;
}

.injoy-form-full {
    grid-column: 1 / -1;
}

.injoy-form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}

.injoy-form-group input {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.injoy-form-group input:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.injoy-form-group input:required {
    border-left: 4px solid #0ea5e9;
}

@media (max-width: 768px) {
    .injoy-form-grid {
        grid-template-columns: 1fr;
    }

    .injoy-form-full {
        grid-column: 1;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .injoy-card {
        padding: 1rem;
    }

    .injoy-summary-grid {
        grid-template-columns: 1fr;
    }

    .injoy-actions {
        flex-direction: column;
    }

    .injoy-volume-control {
        flex-direction: column;
        gap: 0.5rem;
    }

    .injoy-slider {
        width: 250px;
    }

    #audiogram-canvas {
        width: 100%;
        height: 300px;
    }
}

.injoy-btn-primary {
    background: #045e87;
    color: white;
    width: 100%;
}

.injoy-btn-primary:hover:not(:disabled) {
    background: #034557;
}

.injoy-btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.injoy-btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.injoy-btn-secondary:hover {
    background: #cbd5e1;
}

.injoy-btn-round {
    width: 8rem;
    height: 8rem;
    border-radius: 50%;
    font-size: 2rem;
    background: #045e87;
    color: white;
}

.injoy-btn-round:hover {
    transform: scale(1.05);
}

.injoy-btn-test {
    width: 6rem;
    height: 6rem;
    border-radius: 50%;
    font-size: 1.5rem;
    background: #045e87;
    color: white;
    margin-bottom: 1rem;
}

.injoy-progress-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.injoy-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.injoy-step-number {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #64748b;
    font-weight: bold;
}

.injoy-step.active .injoy-step-number {
    background: #045e87;
    color: white;
}

.injoy-step.completed .injoy-step-number {
    background: #66cfeb;
    color: white;
}

.injoy-step-line {
    width: 4rem;
    height: 2px;
    background: #e2e8f0;
    margin: 0 1rem;
}

.injoy-step-line.completed {
    background: #66cfeb;
}

.injoy-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.injoy-info-box {
    background: #eff6ff;
    border: 1px solid #66cfeb;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.injoy-info-icon {
    color: #045e87;
    margin-right: 0.5rem;
}

.injoy-calibration-button {
    text-align: center;
    margin: 2rem 0;
}

.injoy-calibration-text {
    text-align: center;
    color: #64748b;
    margin: 1rem 0;
}

.injoy-progress {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.injoy-progress-bar {
    height: 100%;
    background: #045e87;
    transition: width 0.3s;
}

.injoy-test-controls {
    text-align: center;
}

.injoy-volume-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
}

.injoy-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
}

.injoy-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #045e87;
    cursor: pointer;
}

.injoy-chart {
    margin: 2rem 0;
    text-align: center;
}

.injoy-result-summary {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.injoy-recommendations {
    margin: 2rem 0;
}

.injoy-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.injoy-actions .injoy-btn {
    flex: 1;
}

.injoy-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.injoy-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #045e87;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

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

/* Modal Popup Styles */
.injoy-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.injoy-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.injoy-modal-container {
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.injoy-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.injoy-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.injoy-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.injoy-modal-close:hover {
    background: #e2e8f0;
    color: #374151;
}

.injoy-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.injoy-modal-content #injoy-hearing-test-app {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    min-height: auto;
}

.injoy-modal-content .injoy-screen {
    padding: 1.5rem;
    min-height: auto;
}

.injoy-modal-content .injoy-card {
    box-shadow: none;
    border: none;
    padding: 1.5rem;
    margin: 0;
}

/* Mobile Responsive Modal */
@media (max-width: 768px) {
    .injoy-modal {
        padding: 10px;
        align-items: flex-end;
    }

    .injoy-modal-container {
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
    }

    .injoy-modal-header {
        padding: 15px 20px;
    }

    .injoy-modal-header h2 {
        font-size: 1.25rem;
    }

    .injoy-modal-content .injoy-screen {
        padding: 1rem;
    }

    .injoy-modal-content .injoy-card {
        padding: 1rem;
    }

    .injoy-title {
        font-size: 1.5rem;
    }

    .injoy-form-grid {
        grid-template-columns: 1fr;
    }

    .injoy-form-full {
        grid-column: 1;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .injoy-modal {
        padding: 0;
        align-items: stretch;
    }

    .injoy-modal-container {
        max-height: 100vh;
        border-radius: 0;
        height: 100%;
    }

    .injoy-modal-header {
        padding: 12px 16px;
    }

    .injoy-modal-content .injoy-screen {
        padding: 0.75rem;
    }

    .injoy-modal-content .injoy-card {
        padding: 0.75rem;
    }
}

/* Tablet styles */
@media (min-width: 769px) and (max-width: 1024px) {
    .injoy-modal-container {
        max-width: 700px;
    }
}

/* Popup trigger button styles */
.injoy-popup-trigger,
[data-action="hearing-test-popup"] {
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: inline-block !important;
    text-align: center !important;
    border: none !important;
    cursor: pointer !important;
}

.injoy-popup-trigger:hover,
[data-action="hearing-test-popup"]:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(4, 94, 135, 0.4) !important;
    background: #034557 !important;
}

.injoy-popup-trigger:focus,
[data-action="hearing-test-popup"]:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(4, 94, 135, 0.3) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .injoy-card {
        padding: 1rem;
    }

    .injoy-title {
        font-size: 1.5rem;
    }

    .injoy-progress-steps {
        font-size: 0.875rem;
    }

    .injoy-step-line {
        width: 2rem;
    }

    .injoy-actions {
        flex-direction: column;
    }
}

/* Mobile touch controls */
        .mobile-volume-controls {
            display: none;
            justify-content: center;
            gap: 8px;
            margin: 15px 0;
        }

        .mobile-volume-btn {
            background: #f8f9fa;
            border: 1px solid #e1e5e9;
            padding: 8px 12px;
            border-radius: 6px;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.2s ease;
            touch-action: manipulation;
        }

        .mobile-volume-btn:hover {
            background: #e9ecef;
            border-color: #045e87;
        }

        .mobile-volume-btn:active {
            transform: scale(0.95);
        }

        /* Volume level indicator */
        .volume-level-indicator {
            height: 4px;
            background: linear-gradient(90deg, #28a745, #ffc107, #dc3545);
            border-radius: 2px;
            margin: 5px 0;
            transition: width 0.1s ease;
        }

        /* Keyboard shortcuts hint */
        .keyboard-shortcuts {
            background: #f8f9fa;
            border: 1px solid #e1e5e9;
            padding: 10px;
            border-radius: 6px;
            margin: 15px 0;
            font-size: 12px;
            color: #666;
            text-align: center;
        }

        @media (max-width: 768px) {
            body {
                padding: 0;
            }

            .header {
                padding: 20px;
            }

            .header h1 {
                font-size: 1.5rem;
            }

            .content {
                padding: 20px;
            }

            .results-summary {
                grid-template-columns: 1fr;
            }

            .play-button {
                width: 100px;
                height: 100px;
                font-size: 20px;
                touch-action: manipulation;
            }

            .mobile-volume-controls {
                display: flex;
            }

            .keyboard-shortcuts {
                display: none;
            }

            /* Larger touch targets */
            .slider {
                height: 12px;
            }

            .slider::-webkit-slider-thumb {
                width: 28px;
                height: 28px;
            }

            .slider::-moz-range-thumb {
                width: 28px;
                height: 28px;
            }

            /* Improved button sizing for touch */
            .btn {
                min-height: 48px;
                font-size: 16px;
                touch-action: manipulation;
            }
        }