/**
 * JobVisitors — Polish CSS
 * Final touches: smooth scroll, focus rings, print styles, accessibility,
 * skeleton loaders, micro-animations.
 *
 * @package JobVisitors
 * @since 1.0.0
 */

/* ═══ Smooth Scroll ═══ */
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══ Accessibility: Focus Rings ═══ */
*:focus-visible {
    outline: 2px solid var(--primary, #14B8A6);
    outline-offset: 2px;
    border-radius: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary, #14B8A6);
    outline-offset: 2px;
}

/* Skip to main content link */
.jv-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 9999;
    padding: 12px 20px;
    background: var(--primary, #14B8A6);
    color: #fff;
    font-weight: 600;
    border-radius: 0 0 8px 0;
}
.jv-skip-link:focus { left: 0; }

/* ═══ Skeleton Loaders ═══ */
.jv-skeleton {
    background: linear-gradient(90deg, var(--bg, #F4F7FA) 25%, rgba(0,0,0,0.04) 50%, var(--bg, #F4F7FA) 75%);
    background-size: 200% 100%;
    animation: jvSkeleton 1.4s ease-in-out infinite;
    border-radius: 8px;
}
@keyframes jvSkeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.jv-skeleton--line { height: 14px; margin-bottom: 8px; }
.jv-skeleton--title { height: 22px; width: 60%; margin-bottom: 12px; }
.jv-skeleton--card { height: 200px; border-radius: 18px; }
.jv-skeleton--avatar { width: 48px; height: 48px; border-radius: 50%; }

/* ═══ Toast Notifications ═══ */
.jv-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.jv-toast {
    background: var(--card, #fff);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 20px;
    min-width: 280px;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: jvToastSlide 0.3s ease;
    font-size: 14px;
}
.jv-toast--success { border-left: 4px solid #10B981; }
.jv-toast--error { border-left: 4px solid #EF4444; }
.jv-toast--info { border-left: 4px solid #3B82F6; }
.jv-toast--warning { border-left: 4px solid #F59E0B; }
@keyframes jvToastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ═══ Loading Spinner ═══ */
.jv-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}
.jv-loader__spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary, #14B8A6);
    border-radius: 50%;
    animation: jvSpin 0.8s linear infinite;
}
@keyframes jvSpin {
    to { transform: rotate(360deg); }
}

/* ═══ Micro Interactions ═══ */
.jv-btn,
.jv-listing-card,
.jv-blog-card,
.jv-service-card,
.jv-team-card,
.jv-mentor-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.jv-listing-card:hover,
.jv-blog-card:hover,
.jv-service-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.08);
}

/* ═══ Print Styles ═══ */
@media print {
    .jv-header,
    .jv-footer,
    .jv-dash-sidebar,
    .jv-share-bar,
    .no-print,
    button,
    .jv-btn {
        display: none !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 11pt;
    }

    a {
        color: #000 !important;
        text-decoration: none !important;
    }

    .jv-container {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .jv-blog-card,
    .jv-listing-card {
        page-break-inside: avoid;
        border: 1px solid #ddd;
    }
}

/* ═══ Image Optimization (CSS-side) ═══ */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

img[loading="lazy"] {
    background: var(--bg, #F4F7FA);
}

/* ═══ Container Queries Fallback ═══ */
.jv-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

@media (max-width: 768px) {
    .jv-container { padding: 0 16px; }
}

/* ═══ Selection Color ═══ */
::selection {
    background: var(--primary, #14B8A6);
    color: #fff;
}

/* ═══ Scrollbar Styling ═══ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg, #F4F7FA);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary, #14B8A6);
}

/* ═══ No-JS Fallback ═══ */
.no-js .jv-requires-js {
    display: none;
}

/* ══════════════════════════════════════════════════════════════
   Legal Pages (Privacy, Terms, Refund, Disclaimer, Cookies)
   ════════════════════════════════════════════════════════════ */
.jv-legal-page {
    background: linear-gradient(180deg, rgba(30,76,176,0.04) 0%, rgba(30,76,176,0.0) 320px),
                var(--bg-primary, #fff);
    padding: 0 0 80px;
}
.jv-legal-shell {
    max-width: 920px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 20px 0;
}
.jv-legal-breadcrumb {
    font-size: 13px;
    color: var(--text-muted, #6B7280);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.jv-legal-breadcrumb a {
    color: var(--primary, #1E4CB0);
    text-decoration: none;
    font-weight: 500;
}
.jv-legal-breadcrumb a:hover { text-decoration: underline; }
.jv-legal-breadcrumb__current {
    color: var(--text-primary, #101828);
    font-weight: 500;
}
.jv-legal-hero {
    text-align: center;
    padding: 16px 8px 36px;
}
.jv-legal-hero__pill {
    display: inline-block;
    background: rgba(30,76,176,0.10);
    color: var(--primary, #1E4CB0);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 16px;
}
.jv-legal-hero__title {
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: clamp(1.85rem, 4.5vw, 2.75rem);
    font-weight: 700;
    line-height: 1.15;
    color: var(--text-primary, #101828);
    margin: 0 0 12px;
}
.jv-legal-hero__meta {
    font-size: 14px;
    color: var(--text-muted, #6B7280);
    margin: 0 0 18px;
}
.jv-legal-hero__lead {
    max-width: 640px;
    margin: 0 auto;
    font-size: clamp(15px, 1.8vw, 17px);
    line-height: 1.65;
    color: var(--text-secondary, #4B5563);
}
.jv-legal-card {
    background: #fff;
    border: 1px solid var(--border, #E5E7EB);
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(16, 24, 40, 0.04);
    padding: clamp(24px, 4.5vw, 56px);
    margin-top: 12px;
}
.jv-legal-content {
    color: var(--text-primary, #101828);
    font-size: clamp(15px, 1.8vw, 16px);
    line-height: 1.75;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.jv-legal-content h2 {
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: clamp(1.15rem, 2.4vw, 1.4rem);
    font-weight: 700;
    color: var(--text-primary, #101828);
    margin: 36px 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(30,76,176,0.12);
}
.jv-legal-content h2:first-child { margin-top: 0; }
.jv-legal-content h3 {
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: clamp(1rem, 2vw, 1.1rem);
    font-weight: 600;
    color: var(--primary, #1E4CB0);
    margin: 24px 0 8px;
}
.jv-legal-content p { margin: 0 0 14px; }
.jv-legal-content ul,
.jv-legal-content ol {
    list-style-position: outside;
    padding-left: 22px;
    margin: 0 0 18px;
}
.jv-legal-content ul { list-style: disc; }
.jv-legal-content ol { list-style: decimal; }
.jv-legal-content li {
    margin-bottom: 8px;
    line-height: 1.7;
}
.jv-legal-content a {
    color: var(--primary, #1E4CB0);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 500;
    word-break: break-word;
}
.jv-legal-content a:hover { color: var(--primary-hover, #163C8A); }
.jv-legal-content strong { font-weight: 600; color: var(--text-primary, #101828); }
.jv-legal-content code {
    background: rgba(30,76,176,0.08);
    color: var(--primary, #1E4CB0);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.92em;
}

/* Footer CTA block */
.jv-legal-footer-cta {
    margin: 40px auto 0;
    max-width: 920px;
}
.jv-legal-footer-cta__inner {
    background: linear-gradient(135deg, rgba(30,76,176,0.06) 0%, rgba(30,76,176,0.02) 100%);
    border: 1px solid rgba(30,76,176,0.15);
    border-radius: 20px;
    padding: clamp(24px, 4vw, 40px);
    text-align: center;
}
.jv-legal-footer-cta__title {
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: clamp(1.15rem, 2.6vw, 1.5rem);
    font-weight: 700;
    color: var(--text-primary, #101828);
    margin: 0 0 8px;
}
.jv-legal-footer-cta__desc {
    color: var(--text-secondary, #4B5563);
    margin: 0 0 20px;
    font-size: 15px;
}
.jv-legal-footer-cta__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

/* Tablet */
@media (max-width: 900px) {
    .jv-legal-shell { padding: 24px 18px 0; }
    .jv-legal-card { border-radius: 18px; }
    .jv-legal-content h2 { margin-top: 30px; }
}

/* Mobile */
@media (max-width: 600px) {
    .jv-legal-page { padding-bottom: 56px; }
    .jv-legal-shell { padding: 16px 14px 0; }
    .jv-legal-hero { padding: 8px 4px 24px; }
    .jv-legal-card {
        padding: 22px 18px;
        border-radius: 16px;
    }
    .jv-legal-content { font-size: 15px; line-height: 1.7; }
    .jv-legal-content ul,
    .jv-legal-content ol { padding-left: 18px; }
    .jv-legal-footer-cta__inner { padding: 22px 18px; }
    .jv-legal-footer-cta__actions .jv-btn { width: 100%; }
}

/* Small mobile */
@media (max-width: 380px) {
    .jv-legal-card { padding: 18px 14px; }
    .jv-legal-hero__title { font-size: 1.6rem; }
}

/* Services CTA panel — used on the Services page banner block */
.jv-services-cta {
    margin: 40px 0 0;
    padding: clamp(28px, 4vw, 48px);
    background: linear-gradient(135deg, var(--primary, #1E4CB0) 0%, #163C8A 100%);
    border-radius: 24px;
    text-align: center;
    color: #fff;
}
.jv-services-cta h2 {
    color: #fff;
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    margin: 0 0 10px;
}
.jv-services-cta p {
    color: rgba(255,255,255,0.85);
    font-size: clamp(14px, 1.8vw, 16px);
    margin: 0 auto 22px;
    max-width: 540px;
}

/* Universal mobile guard against horizontal scroll */
@media (max-width: 600px) {
    body { overflow-x: hidden; }
    .jv-container { padding-left: 16px; padding-right: 16px; }
}
