/**
 * Dynamic Quiz AJAX Results Styles
 *
 * @package SportPersonalities
 * @since 2.4.0
 */

/* Loading overlay and animation */
.quiz-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.quiz-loading-overlay.active {
    opacity: 1;
}

.quiz-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0c52c7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.quiz-loading-text {
    margin-top: 20px;
    font-size: 1.125rem;
    color: #333;
    font-weight: 600;
}

.quiz-loading-progress {
    margin-top: 10px;
    font-size: 0.95rem;
    color: #666;
}

/* Fade out quiz form */
.quiz-form-fading-out {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Main results container with fade-in animation */
.quiz-results-ajax-container {
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Results title */
.dynamic-quiz-results-container .results-title {
    text-align: center;
    color: #0c1f37;
    margin-bottom: 30px;
    font-size: 2em;
    font-weight: 700;
}

/* Outcome section */
.outcome-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #0c52c7;
}

.outcome-name {
    color: #0c52c7;
    font-size: 1.75em;
    margin-bottom: 15px;
    font-weight: 700;
}

.outcome-description {
    line-height: 1.8;
    color: #333;
    font-size: 1.05em;
}

.outcome-description p {
    margin-bottom: 15px;
}

.outcome-description p:last-child {
    margin-bottom: 0;
}

/* Match confidence indicator */
.match-confidence {
    margin-top: 20px;
    padding: 12px 16px;
    background: #e8f4fd;
    border-left: 4px solid #0c52c7;
    display: inline-block;
    border-radius: 4px;
}

.match-confidence span {
    color: #0c1f37;
    font-size: 0.95em;
}

.match-confidence strong {
    color: #0c52c7;
    font-size: 1.1em;
    margin-left: 5px;
}

/* Scale chart container */
.scale-chart-container {
    margin: 30px 0;
    padding: 25px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.chart-title {
    color: #0c1f37;
    font-size: 1.4em;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}

/* Scale breakdowns */
.scale-breakdowns {
    margin-top: 30px;
}

.breakdown-title {
    color: #0c1f37;
    font-size: 1.3em;
    margin-bottom: 20px;
    font-weight: 600;
}

.scale-item {
    margin-bottom: 20px;
    padding: 15px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e8e8e8;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.scale-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.scale-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
}

.scale-name {
    color: #0c1f37;
    font-size: 1em;
}

.scale-percentage {
    color: #0c52c7;
    font-size: 1.1em;
    font-weight: 700;
}

.scale-bar {
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.scale-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0c52c7, #1065f0);
    transition: width 0.8s ease;
    border-radius: 12px;
    position: relative;
}

.scale-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
}

/* Results action buttons */
.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

.results-actions button {
    padding: 14px 28px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.results-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.results-actions button:active {
    transform: translateY(0);
}

.btn-retake-quiz {
    background: #6c757d;
    color: white;
}

.btn-retake-quiz:hover {
    background: #5a6268;
}

.btn-share-results,
.btn-download-results {
    background: #0c52c7;
    color: white;
}

.btn-share-results:hover,
.btn-download-results:hover {
    background: #0a47b3;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .quiz-results-ajax-container {
        padding: 20px;
        margin-top: 20px;
    }

    .dynamic-quiz-results-container .results-title {
        font-size: 1.5em;
        margin-bottom: 20px;
    }

    .outcome-section {
        padding: 20px;
    }

    .outcome-name {
        font-size: 1.4em;
    }

    .outcome-description {
        font-size: 1em;
    }

    .scale-chart-container {
        padding: 15px;
    }

    .chart-title,
    .breakdown-title {
        font-size: 1.2em;
    }

    .results-actions {
        flex-direction: column;
        gap: 10px;
    }

    .results-actions button {
        width: 100%;
        padding: 12px 20px;
    }

    .scale-item {
        padding: 12px;
    }

    /* Archetype Integration Section - Stack portrait and text on mobile */
    .quiz-results-page section[style*="grid-template-columns"] > div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .quiz-results-page .portrait-panel {
        max-width: 300px;
        margin: 0 auto !important;
    }
}

/* Tablet responsive */
@media (max-width: 992px) and (min-width: 769px) {
    .quiz-results-ajax-container {
        padding: 25px;
    }

    .results-actions button {
        padding: 12px 24px;
        font-size: 15px;
    }
}

/* Print styles */
@media print {
    .results-actions {
        display: none;
    }

    .quiz-results-ajax-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .scale-item:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Accessibility improvements */
.results-actions button:focus {
    outline: 3px solid #0c52c7;
    outline-offset: 2px;
}

.scale-bar {
    position: relative;
}

.scale-bar::before {
    content: attr(aria-label);
    position: absolute;
    left: -9999px;
}

/* Social Share Buttons */
.social-share-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.social-share-buttons a,
.social-share-buttons button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.social-share-buttons a:hover,
.social-share-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.social-share-buttons a:active,
.social-share-buttons button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.share-btn-facebook {
    background: #1877f2;
    color: white;
}

.share-btn-facebook:hover {
    background: #145dbf;
}

.share-btn-linkedin {
    background: #0077b5;
    color: white;
}

.share-btn-linkedin:hover {
    background: #005f8f;
}

.share-btn-x {
    background: #000000;
    color: white;
}

.share-btn-x:hover {
    background: #333333;
}

.share-btn-copy {
    background: #6c757d;
    color: white;
}

.share-btn-copy:hover {
    background: #5a6268;
}

.social-share-buttons svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Focus states for accessibility */
.social-share-buttons a:focus,
.social-share-buttons button:focus {
    outline: 3px solid #0c52c7;
    outline-offset: 2px;
}

/* Mobile responsive for social buttons */
@media (max-width: 576px) {
    .social-share-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .social-share-buttons a,
    .social-share-buttons button {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }
}

/* Dark mode support (if theme supports it) */
@media (prefers-color-scheme: dark) {
    .quiz-results-ajax-container {
        background: #ffffff;
        color: #e0e0e0;
    }

    .outcome-section {
        background: #2a2a2a;
    }

    .outcome-name,
    .results-title,
    .scale-name,
    .chart-title,
    .breakdown-title {
        color: #ffffff;
    }

    .outcome-description {
        color: #d0d0d0;
    }

    .scale-chart-container {
        background: #2a2a2a;
        border-color: #3a3a3a;
    }

    .scale-item {
        background: #2a2a2a;
        border-color: #3a3a3a;
    }

    .scale-bar {
        background: #3a3a3a;
    }
}

/* ================================================================
   PHASE 3: ENHANCED UI/UX - UPSELL SECTIONS & MODAL STYLES
   ================================================================ */

/* Upsell Section Styles */
.quiz-upsell-section {
    position: relative;
    overflow: hidden;
}

.upsell-cta-grid {
    position: relative;
    z-index: 1;
}

.upsell-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.upsell-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15) !important;
}

.upsell-btn-primary,
.upsell-btn-consultation {
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.upsell-btn-primary:hover {
    background: #0a47b3 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(12, 82, 199, 0.3);
}

.upsell-btn-consultation:hover {
    background: #a50e09 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(182, 15, 10, 0.3);
}

/* Modal Styles */
.quiz-upsell-modal {
    animation: fadeIn 0.3s ease;
}

.quiz-upsell-modal-content {
    animation: slideUp 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.quiz-upsell-modal-close:hover {
    color: #333 !important;
    transform: rotate(90deg);
}

.modal-btn-primary:hover {
    background: #a50e09 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(182, 15, 10, 0.4);
}

.modal-btn-secondary:hover {
    background: #dee2e6 !important;
}

/* Single-Scale Layout Improvements */
.single-scale-layout {
    animation: fadeIn 0.5s ease;
}

/* Enhanced Progress Bar with Zones (Single-Scale) */
.enhanced-progress-wrapper {
    position: relative;
    margin: 20px 0;
}

.enhanced-progress-wrapper:hover .score-marker {
    transform: scale(1.1);
}

/* Mobile Responsive for Upsell */
@media (max-width: 768px) {
    .quiz-upsell-section {
        padding: 30px 20px !important;
        margin: 30px 0 !important;
    }

    .quiz-upsell-section h3 {
        font-size: 1.5rem !important;
    }

    .quiz-upsell-section p {
        font-size: 1rem !important;
    }

    .upsell-cta-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    .upsell-card {
        padding: 20px !important;
    }

    .upsell-btn-primary,
    .upsell-btn-consultation {
        padding: 10px 20px !important;
        font-size: 0.95rem !important;
        width: 100%;
    }
}

/* Mobile Responsive for Modal */
@media (max-width: 768px) {
    .quiz-upsell-modal {
        padding: 10px !important;
    }

    .quiz-upsell-modal-content {
        max-height: 95vh !important;
        border-radius: 12px !important;
    }

    .modal-header {
        padding: 20px 20px 15px !important;
    }

    .modal-header h3 {
        font-size: 1.5rem !important;
    }

    .modal-body {
        padding: 15px 20px !important;
    }

    .price-display {
        font-size: 2rem !important;
    }

    .modal-cta-buttons {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .modal-btn-primary,
    .modal-btn-secondary {
        flex: 1 !important;
    }
}

/* Mobile Responsive for Single-Scale Progress Bar */
@media (max-width: 640px) {
    .enhanced-progress-wrapper {
        height: 35px !important;
        margin-bottom: 25px !important;
    }

    .enhanced-progress-wrapper .zone-labels {
        font-size: 0.65rem !important;
        margin-top: 10px !important;
    }
}

/* Improved Chart Panel */
.chart-panel {
    position: relative;
}

.chart-panel h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Portrait Panel Enhancements */
.portrait-panel {
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 30px 25px 30px !important;
}

.portrait-panel:hover {
    transform: scale(1.02);
}

.portrait-panel__image {
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.portrait-panel__image:hover {
    opacity: 0.9;
}

.portrait-panel__label {
    margin: 20px 0 0 0 !important;
}

.portrait-panel__motto {
    font-size: 0.95rem;
    font-style: italic;
    color: #666;
    margin: 12px 0 0 0;
    line-height: 1.5;
    padding: 0 10px;
}

/* Loading Animation for Charts */
@keyframes chartLoad {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.ssp-quiz-chart {
    animation: chartLoad 0.5s ease;
}

/* Smooth Transitions for All Interactive Elements */
.quiz-results-ajax-container a,
.quiz-results-ajax-container button {
    transition: all 0.3s ease;
}

/* Focus States for Accessibility */
.quiz-results-ajax-container a:focus,
.quiz-results-ajax-container button:focus {
    outline: 2px solid #0c52c7;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .quiz-upsell-section,
    .quiz-upsell-modal,
    .btn-retake-quiz,
    .social-share-buttons {
        display: none !important;
    }

    .quiz-results-ajax-container {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .quiz-results-ajax-container {
        border: 2px solid #000 !important;
    }

    .upsell-card {
        border: 2px solid #000 !important;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .quiz-results-ajax-container *,
    .quiz-upsell-section *,
    .quiz-upsell-modal * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Preparation (for future implementation) */
@media (prefers-color-scheme: dark) {
    /* Styles commented out for now, can be enabled when needed
    .quiz-results-ajax-container {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    */
}
