/* Global Tools Master CSS */
/* Show Top/Mobile Nav, Hide Massive Site Footer */
#navbar-container, #top-bar-container { display: block !important; }
.site-footer, footer, #footer-container { display: none !important; }

/* Prevent any possible click interception issues on 3D overlays */
.waeyuk-topbar,
.waeyuk-navbar.mobile-only {
    pointer-events: auto !important;
}

html, body {
    margin: 0;
    padding: 0;
    background: #000000;
    color: #ffffff;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    font-family: 'Tajawal', 'Inter', sans-serif;
    min-height: 100%;
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    z-index: 1;
}

/* Make sure overlays sit above canvas but below topbar */
.ui-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100dvh;
    pointer-events: none;
    z-index: 5;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Master Top Bar Styling */
.waeyuk-topbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 60px !important;
    background: rgba(10, 10, 10, 0.92) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    z-index: 999999 !important; /* Above everything */
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 24px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-sizing: border-box !important;
    direction: rtl !important;
}

.waeyuk-topbar .topbar-logo {
    font-size: 20px !important;
    font-weight: 900 !important;
    color: #00d2ff !important;
    font-family: 'Tajawal', sans-serif !important;
    letter-spacing: 0.5px !important;
}

.waeyuk-topbar .topbar-links {
    display: flex !important;
    gap: 16px !important;
    align-items: center !important;
}

.waeyuk-topbar a {
    color: rgba(255, 255, 255, 0.7) !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    transition: color 0.2s ease, transform 0.2s ease !important;
    margin: 0 !important;
    font-family: 'Tajawal', sans-serif !important;
}

.waeyuk-topbar a:hover {
    color: #00d2ff !important;
    transform: translateY(-1px) !important;
}

.waeyuk-navbar.mobile-only {
    display: flex !important; /* Displayed as a premium floating dock on all screens */
    position: fixed !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: clamp(300px, 90%, 500px) !important;
    background: rgba(10, 10, 15, 0.85) !important;
    backdrop-filter: blur(25px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 50px !important;
    padding: 10px 20px !important;
    z-index: 99999 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    justify-content: space-around !important;
    align-items: center !important;
    box-sizing: border-box !important;
    direction: rtl !important;
}

.waeyuk-navbar.mobile-only a {
    color: rgba(255, 255, 255, 0.5) !important;
    text-decoration: none !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    font-size: 1.2rem !important;
    transition: all 0.3s ease !important;
}

.waeyuk-navbar.mobile-only a:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-3px) !important;
}

.waeyuk-navbar.mobile-only a.active {
    color: #00d2ff !important;
    background: rgba(0, 210, 255, 0.1) !important;
    box-shadow: 0 4px 12px rgba(0, 210, 255, 0.2) !important;
}

@media (max-width: 768px) {
    .waeyuk-navbar.mobile-only {
        display: flex !important; /* Only shown on mobile viewports */
        bottom: calc(12px + env(safe-area-inset-bottom)) !important;
        width: 90% !important;
        max-width: 400px !important;
        padding: 8px 16px !important;
        border-radius: 30px !important;
    }
    .waeyuk-navbar.mobile-only a {
        width: 38px !important;
        height: 38px !important;
        font-size: 1.1rem !important;
    }
}

.tool-content-section {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1000000 !important; /* Above all content and canvases */
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(15px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(15px) saturate(180%) !important;
    display: none !important; /* Hidden by default */
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

.tool-content-section.active {
    display: flex !important;
    animation: modalFadeIn 0.3s ease forwards;
}

/* Inner modal wrapper holding stats & guide cards */
.tool-content-modal-card {
    background: rgba(15, 15, 20, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 30px !important;
    border-radius: 24px !important;
    width: 100% !important;
    max-width: 500px !important;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 210, 255, 0.15) !important;
    box-sizing: border-box !important;
    text-align: right !important;
    direction: rtl !important;
    position: relative !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.tool-content-close-btn {
    position: absolute !important;
    top: 15px !important;
    left: 20px !important;
    background: none !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.4) !important;
    font-size: 32px !important;
    cursor: pointer !important;
    line-height: 1 !important;
    transition: color 0.2s, transform 0.2s !important;
    z-index: 10 !important;
}

.tool-content-close-btn:hover {
    color: #ff4757 !important;
    transform: scale(1.1) !important;
}

.tool-content-section h2 {
    color: #00d2ff;
    text-align: center;
    margin-bottom: 30px;
}

.tool-stats-dashboard {
    background: linear-gradient(135deg, #111111 0%, #070707 100%);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.tool-content-section a[href*="specialists"] {
    display: inline-block !important;
    background: linear-gradient(135deg, #00d2ff 0%, #00a2ff 100%) !important;
    color: #000 !important;
    padding: 12px 28px !important;
    text-decoration: none !important;
    border-radius: 30px !important;
    font-weight: 800 !important;
    font-size: 14px !important;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.tool-content-section a[href*="specialists"]:hover {
    transform: scale(1.05) translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(0, 210, 255, 0.5) !important;
    filter: brightness(1.1) !important;
}


.waeyuk-footer {
    position: relative;
    z-index: 10;
    background: #000;
    padding: 30px;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.05);
    color: #555;
    font-size: 12px;
}

/* Mobile responsive adjustments for tools UI overlays globally */
@media (max-width: 768px) {
    /* Prevent backdrop filters on cheap mobile phones from lagging Three.js/Babylon scenes */
    * { 
        backdrop-filter: none !important; 
        -webkit-backdrop-filter: none !important; 
    }

    .ui-overlay {
        padding: calc(65px + env(safe-area-inset-top)) 12px calc(80px + env(safe-area-inset-bottom)) !important;
        justify-content: flex-end !important; /* Push tools action panel closer to thumb area */
        height: 100dvh !important;
        box-sizing: border-box !important;
    }

    .header-box {
        max-width: 100% !important;
        width: 100% !important;
        margin: auto 0 0 0 !important; /* Bottom anchor in UI overlay content area */
        padding: 14px 16px !important;
        border-radius: 16px !important;
        box-sizing: border-box !important;
        text-align: right !important;
        background: rgba(10, 10, 10, 0.85) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
    }

    .header-box .header {
        text-align: right !important;
        margin-bottom: 10px !important;
    }

    .header-box .header h1 {
        font-size: 16px !important;
        font-weight: 800 !important;
        color: #fff !important;
        margin: 0 0 4px 0 !important;
    }

    .header-box .header p {
        font-size: 11px !important;
        font-weight: 500 !important;
        color: #ccc !important;
        line-height: 1.4 !important;
        margin: 0 !important;
    }

    .header-box .footer {
        width: 100% !important;
        margin-top: 10px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    /* Target all buttons inside tool action panels */
    .header-box button,
    .header-box .btn,
    .header-box [class^="btn-"] {
        width: 100% !important;
        min-height: 44px !important; /* Standard mobile touch-target dimensions */
        padding: 10px 20px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        border-radius: 25px !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        outline: none !important;
    }

    .header-box .input-area {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .header-box input[type="text"],
    .header-box input {
        width: 100% !important;
        height: 44px !important;
        padding: 10px 15px !important;
        font-size: 13px !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        color: #fff !important;
        border-radius: 25px !important;
        box-sizing: border-box !important;
        text-align: right !important;
        outline: none !important;
    }

    .header-box input:focus {
        border-color: var(--primary, #00d2ff) !important;
        background: rgba(255, 255, 255, 0.15) !important;
    }

    /* Responsive overrides for Top-bar, Guidelines and Stats Dashboard */
    .waeyuk-topbar {
        padding: 10px 16px !important;
        height: 56px !important;
        align-items: center !important;
    }
    .waeyuk-topbar .topbar-logo {
        font-size: 16px !important;
    }
    .waeyuk-topbar a {
        font-size: 12px !important;
        margin-left: 10px !important;
    }

    .tool-content-section {
        padding: 40px 16px !important;
        min-height: 40vh !important;
    }
    .tool-content-section h2 {
        font-size: 18px !important;
        margin-bottom: 20px !important;
    }
    .tool-stats-dashboard {
        padding: 16px !important;
        margin-bottom: 25px !important;
        border-radius: 12px !important;
    }
    .tool-stats-dashboard h2 {
        font-size: 14px !important;
        margin-bottom: 15px !important;
    }
    .tool-stats-dashboard div[style*="font-size: 24px"] {
        font-size: 20px !important;
    }
    .tool-stats-dashboard div[style*="font-size: 12px"] {
        font-size: 10px !important;
    }
    .tool-content-section ul {
        padding-right: 15px !important;
    }
    .tool-content-section a[href*="specialists"] {
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 12px 16px !important;
        font-size: 13px !important;
        text-align: center !important;
        border-radius: 25px !important;
    }
}

/* Responsive overrides for all psychological tests/quiz pages */
@media (max-width: 768px) {
    /* 1. Main containers responsiveness */
    .test-container,
    .container,
    .waeyuk-test-container,
    .container-wrapper,
    #quizBox,
    #container-wrapper {
        width: auto !important;
        max-width: calc(100% - 24px) !important;
        margin: 80px 12px 120px 12px !important; /* Spacing for Top Bar and Bottom floating nav */
        padding: 24px 16px !important;
        border-radius: 20px !important;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5) !important;
        box-sizing: border-box !important;
    }

    /* 2. Titles and Headers */
    .test-name,
    .waeyuk-test-name {
        font-size: 22px !important;
        line-height: 1.3 !important;
        margin-bottom: 8px !important;
    }

    .test-header p,
    .title,
    .text-dim {
        font-size: 14px !important;
        line-height: 1.5 !important;
        margin-bottom: 16px !important;
    }

    /* 3. Questions */
    .question,
    .waeyuk-question {
        font-size: 17px !important;
        line-height: 1.5 !important;
        margin-bottom: 20px !important;
    }

    /* 4. Answer options lists */
    .answers,
    .waeyuk-ans-list {
        display: grid !important;
        grid-template-columns: 1fr !important; /* Force stack vertically */
        gap: 10px !important;
        padding: 0 !important;
        margin: 0 0 20px 0 !important;
    }

    /* 5. Answer items */
    .answers li,
    .waeyuk-ans-item {
        padding: 14px 16px !important;
        font-size: 14px !important;
        border-radius: 12px !important;
        gap: 12px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }

    .waeyuk-ans-item {
        justify-content: flex-start !important; /* Keep radio/bullet aligned to right/left */
        text-align: right !important;
    }

    /* 6. Buttons container */
    .nav-btns,
    .btns-container,
    .btns-container div {
        margin-top: 24px !important;
        gap: 10px !important;
        display: flex !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    /* 7. Buttons styling */
    .btn,
    .nav-btn,
    .waeyuk-btn {
        padding: 10px 20px !important;
        font-size: 14px !important;
        border-radius: 12px !important;
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        font-weight: 700 !important;
        box-sizing: border-box !important;
    }

    /* 8. Progress indicators */
    .progress-wrap,
    .waeyuk-progress-wrap {
        margin: 16px 0 !important;
        gap: 12px !important;
    }

    .progress-bar-container,
    .progress-bar,
    .waeyuk-progress-bar {
        height: 6px !important;
    }

    /* 9. Results / Score / Toxicity meters */
    .toxicity-meter,
    .result-hex,
    .result-score-circle {
        width: 130px !important;
        height: 130px !important;
        margin: 0 auto 20px !important;
        border-width: 6px !important;
    }

    .toxicity-meter .percentage,
    .result-score,
    .score-val {
        font-size: 28px !important;
    }

    .toxicity-meter .label,
    .score-total {
        font-size: 11px !important;
    }

    .result-card {
        padding: 20px 16px !important;
        border-radius: 20px !important;
    }

    .result-title,
    .result-level {
        font-size: 18px !important;
        margin-bottom: 12px !important;
    }

    .result-desc {
        font-size: 14px !important;
        line-height: 1.6 !important;
        margin-bottom: 20px !important;
    }

    /* 10. Contact box / CTA Specialists */
    .contact-box {
        padding: 20px 16px !important;
        border-radius: 16px !important;
        margin-top: 20px !important;
    }

    .contact-box .contact-title {
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }

    .contact-box p:not(.contact-title) {
        font-size: 13px !important;
        line-height: 1.5 !important;
        margin-bottom: 16px !important;
    }

    .contact-box a.btn,
    .contact-box a.waeyuk-btn,
    .contact-box a.nav-btn {
        width: 100% !important;
        padding: 12px !important;
        border-radius: 12px !important;
        font-size: 13px !important;
    }
}


