/*
Theme Name: Pak Legal Desk Child
Template: Pak Legal Desk AI v2
Version: 1.0.0
*/

/* Mobile First Responsive Fixes */
@media (max-width: 768px) {
    /* Force containers to fit mobile screens */
    .container, .site-content, .entry-content, .elementor-section {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    /* Stack grid/flex items vertically on mobile */
    .service-grid, .services-wrapper, .elementor-column {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 20px !important;
    }

    /* Ensure images and icons don't overflow */
    img, svg, .service-icon, .elementor-image-box-img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Fix large headings and text wrapping */
    h1, h2, h3, p {
        font-size: 1.2em !important;
        word-wrap: break-word !important;
        text-align: center !important;
    }
    
    /* Hide horizontal scrollbar */
    body, html {
        overflow-x: hidden !important;
    }
}

/* --- Verified & Unverified Badges --- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.verified {
    background-color: #28a745; /* Green */
    color: #ffffff;
}

.badge.unverified {
    background-color: #ffc107; /* Amber/Yellow */
    color: #212529;
}


/* ================================================
   MOBILE RESPONSIVENESS - Enhanced for 393px viewport
   ================================================ */
@media (max-width: 768px) {
    /* Prevent horizontal scroll */
    html, body { overflow-x: hidden; max-width: 100vw; }
    * { box-sizing: border-box; }

    /* Container padding */
    .homepage-wrapper, .site-content, .site-content-wrapper {
        padding: 16px 12px !important;
        max-width: 100% !important;
    }

    /* Force service grids to single column */
    .homepage-wrapper > div[style*="display:grid"],
    .homepage-wrapper > div[style*="display: grid"],
    div[style*="grid-template-columns:repeat(auto-fill"] {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* Service cards */
    .homepage-wrapper > div[style*="display:grid"] > div {
        padding: 20px 16px !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Typography scale-down */
    h1 { font-size: 24px !important; line-height: 1.3 !important; }
    h2 { font-size: 20px !important; line-height: 1.3 !important; }
    h3 { font-size: 16px !important; line-height: 1.4 !important; }
    p  { font-size: 14px !important; line-height: 1.5 !important; }

    /* Icons */
    img, svg { max-width: 100%; height: auto; }
    div[style*="font-size:40px"] img,
    div[style*="font-size:34px"] img,
    .service-icon img {
        width: 56px !important;
        height: 56px !important;
    }

    /* Buttons - minimum 44px tap target */
    a[style*="padding:8px 16px"],
    a[style*="padding:6px 12px"],
    .guest-join-btn,
    button {
        min-height: 44px;
        padding: 10px 14px !important;
        font-size: 13px !important;
    }

    /* Stats section - stack vertically */
    div[style*="display:flex"][style*="gap"] {
        flex-direction: column !important;
        gap: 12px !important;
    }

    /* Tables - horizontal scroll if needed */
    table { display: block; overflow-x: auto; width: 100%; }

    /* Prevent any element from breaking out */
    div[style*="min-width"],
    div[style*="width:1200"],
    div[style*="max-width:1200px"] {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    /* Header mobile fixes */
    .pak-header { padding: 0 12px !important; }
    .pak-search-form { max-width: 100% !important; }

    /* Card button row (Free + Generate) */
    div[style*="justify-content:space-between"] {
        gap: 8px;
    }
}

/* Extra-small screens (iPhone SE, older devices) */
@media (max-width: 380px) {
    h1 { font-size: 20px !important; }
    h2 { font-size: 18px !important; }
    h3 { font-size: 15px !important; }
    .homepage-wrapper { padding: 12px 8px !important; }
    div[style*="font-size:40px"] img,
    div[style*="font-size:34px"] img {
        width: 48px !important;
        height: 48px !important;
    }
}


/* ================================================
   TASK 1.3 — Contract Preview Mode
   ================================================ */
.pld-preview-banner {
    max-width: 1100px;
    margin: 20px auto 0;
    padding: 14px 20px;
    background: #c9a227;
    color: #0b1d3a;
    border-radius: 8px;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.3px;
}

.pld-preview-cta {
    text-align: center;
    margin: 24px 0;
    padding: 20px;
    background: #f0fdf4;
    border: 1px solid #1dbf73;
    border-radius: 12px;
}

.pld-preview-cta a {
    display: inline-block;
    padding: 14px 28px;
    background: #1dbf73;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    transition: background 0.2s;
}
.pld-preview-cta a:hover { background: #17a960; }

.pld-preview-truncated {
    position: relative;
    max-height: 500px;
    overflow: hidden;
}
.pld-preview-truncated::after {
    content: "";
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 180px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 85%);
    pointer-events: none;
}

@media (max-width: 768px) {
    .pld-preview-banner { font-size: 13px; padding: 12px 14px; }
    .pld-preview-cta { padding: 16px 12px; }
    .pld-preview-cta a { padding: 12px 20px; font-size: 14px; }
}

/* ================================================
   Mobile fix: Homepage stats must stack vertically
   ================================================ */
@media (max-width: 768px) {

    /* Target any container holding the stat labels */
    div:has(> div > div:contains("Documents Generated")),
    div:has(.stat-item),
    div[class*="stat"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 20px 16px !important;
        overflow: hidden !important;
    }

    /* Force every child of the stats container to stack */
    div[class*="stat"] > *,
    div:has(.stat-item) > * {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 100% !important;
        text-align: center !important;
    }

    /* Stat number size — prevent overflow */
    .stat-number, [class*="stat-number"], strong {
        font-size: 22px !important;
        line-height: 1.2 !important;
        word-break: break-word !important;
    }

    /* Kill any fixed widths on the homepage wrapper */
    .homepage-wrapper [style*="width:"],
    .homepage-wrapper [style*="min-width:"] {
        width: auto !important;
        min-width: 0 !important;
    }

    /* Specifically target inline flex rows */
    .homepage-wrapper > div[style*="display:flex"],
    .homepage-wrapper > div[style*="display: flex"],
    .homepage-wrapper div[style*="gap:40px"],
    .homepage-wrapper div[style*="gap: 40px"] {
        flex-direction: column !important;
        gap: 16px !important;
    }
}

/* ================================================
   Task 1.3b — Homepage Stats mobile stacking
   ================================================ */
@media (max-width: 768px) {
    /* Target stats row by new class or fallback */
    .home-stats,
    .home-stats-wrap,
    div:has(> .stat-item) {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 20px !important;
        padding: 24px 16px !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .stat-item {
        width: 100% !important;
        padding: 8px 0 !important;
        border-bottom: 1px solid #efefef;
    }
    .stat-item:last-child { border-bottom: none; }

    .stat-item .number {
        font-size: 24px !important;
        line-height: 1.3 !important;
    }
    .stat-item .number span { font-size: 20px !important; }

    .stat-item .label {
        font-size: 13px !important;
        margin-top: 4px !important;
    }
}

/* ================================================
   Task 1.3c — Force ALL stats to stack on mobile
   ================================================ */
@media (max-width: 768px) {
    .stat-item {
        display: block !important;
        width: 100% !important;
        flex-basis: 100% !important;
        max-width: 100% !important;
        margin: 0 0 24px 0 !important;
        padding: 12px 0 !important;
    }
    .stat-item:last-child { margin-bottom: 0 !important; }

    /* Force parent to flex column with no wrapping */
    .home-stats,
    div:has(> .stat-item) {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
        width: 100% !important;
    }

    /* Numbers can't overflow */
    .stat-item .number {
        max-width: 100% !important;
        overflow-wrap: break-word !important;
    }
}

/* ================================================
   Task 4.3 — Accessibility (WCAG 2.1 AA)
   ================================================ */

/* Keyboard focus visibility */
*:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #1dbf73;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Skip link focus state */


/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Minimum tap target size (mobile accessibility) */
@media (max-width: 768px) {
    a, button {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ================================================
   Accessibility: Skip-to-content link
   Hidden until keyboard focus (WCAG 2.4.1)
   ================================================ */
.skip-to-content {
    position: absolute !important;
    left: -9999px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
}

.skip-to-content:focus,
.skip-to-content:focus-visible {
    position: fixed !important;
    left: 10px !important;
    top: 10px !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
    padding: 12px 20px !important;
    background: #1dbf73 !important;
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    border-radius: 8px !important;
    z-index: 999999 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
    outline: 3px solid #0b1d3a !important;
    outline-offset: 2px !important;
}

/* ============================================================
 * PLD-HERO-FINAL — one clean stylesheet for the hero. Works with
 * inline styles via !important. Cross-browser (no :has, no CSS Grid
 * required for critical layout).
 * ============================================================ */

/* ---------- Base (all viewports) ---------- */
.pld-pro-hero {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8c 100%) !important;
    color: #fff !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(30, 58, 95, 0.18) !important;
    margin: 16px auto 40px !important;
    padding: 72px 60px 64px !important;
    position: relative !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    text-align: center !important;
}

/* Gold radial glow — subtle depth */
.pld-pro-hero::before {
    content: '' !important;
    position: absolute !important;
    top: -40% !important;
    right: -10% !important;
    width: 640px !important;
    height: 640px !important;
    background: radial-gradient(circle, rgba(200,168,78,0.16) 0%, transparent 65%) !important;
    pointer-events: none !important;
    z-index: 0 !important;
}

/* Inner content wrapper — wider now */
.pld-pro-hero > div {
    max-width: 1080px !important;
    margin: 0 auto !important;
    position: relative !important;
    z-index: 1 !important;
    text-align: center !important;
}

/* Badge */
.pld-pro-hero > div > span:first-child {
    display: inline-block !important;
    background: rgba(200,168,78,0.18) !important;
    color: #c8a84e !important;
    padding: 8px 20px !important;
    border-radius: 999px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: 0.8px !important;
    margin-bottom: 22px !important;
}

/* Tagline */
.pld-pro-hero p {
    font-size: 20px !important;
    line-height: 1.5 !important;
    font-weight: 400 !important;
    color: rgba(255,255,255,0.92) !important;
    max-width: 720px !important;
    margin: 0 auto 32px !important;
}

/* CTA row */
.pld-pro-hero > div > div:nth-child(3) {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 auto 32px !important;
}

/* Buttons */
.pld-pro-hero a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 48px !important;
    padding: 14px 32px !important;
    border-radius: 10px !important;
    font-size: 15.5px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    box-sizing: border-box !important;
}
.pld-pro-hero a:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.18) !important;
}

/* Trust row — horizontal on desktop */
.pld-pro-hero > div > div:last-child {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px 32px !important;
    justify-content: center !important;
    align-items: center !important;
    font-size: 13px !important;
    color: rgba(255,255,255,0.86) !important;
    max-width: 860px !important;
    margin: 0 auto !important;
}
.pld-pro-hero > div > div:last-child > span {
    display: inline-block !important;
    white-space: nowrap !important;
}

/* Headings below the hero */
.pld-pro-hero + h1,
.pld-pro-hero + * + h1 {
    font-size: 34px !important;
    font-weight: 700 !important;
    color: #1e3a5f !important;
    text-align: center !important;
    margin: 56px auto 8px !important;
    letter-spacing: -0.4px !important;
    line-height: 1.2 !important;
}
.pld-pro-hero + h1 + p {
    font-size: 16px !important;
    color: #6b7280 !important;
    text-align: center !important;
    margin: 0 auto 40px !important;
}

/* ---------- Tablet (641–1024) ---------- */
@media (min-width: 641px) and (max-width: 1024px) {
    .pld-pro-hero {
        padding: 56px 40px 48px !important;
        border-radius: 14px !important;
    }
    .pld-pro-hero p {
        font-size: 18px !important;
        max-width: 620px !important;
    }
    .pld-pro-hero > div > div:last-child {
        gap: 10px 24px !important;
    }
}

/* ---------- Mobile (max 640) ---------- */
@media (max-width: 640px) {
    .pld-pro-hero {
        padding: 36px 22px 34px !important;
        border-radius: 14px !important;
        margin: 12px auto 28px !important;
    }
    .pld-pro-hero > div > span:first-child {
        font-size: 11px !important;
        padding: 6px 14px !important;
        margin-bottom: 16px !important;
        letter-spacing: 0.6px !important;
    }
    .pld-pro-hero p {
        font-size: 15px !important;
        line-height: 1.5 !important;
        margin: 0 auto 24px !important;
        max-width: 100% !important;
    }
    /* Stack buttons */
    .pld-pro-hero > div > div:nth-child(3) {
        flex-direction: column !important;
        gap: 10px !important;
        margin-bottom: 24px !important;
    }
    .pld-pro-hero a {
        display: flex !important;
        width: 100% !important;
        max-width: 340px !important;
        margin: 0 auto !important;
        padding: 14px 20px !important;
        font-size: 15px !important;
    }
    /* Trust row — 2 columns via flex-basis (works in all browsers) */
    .pld-pro-hero > div > div:last-child {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 10px 8px !important;
        justify-content: center !important;
        max-width: 100% !important;
        font-size: 12px !important;
    }
    .pld-pro-hero > div > div:last-child > span {
        flex: 0 0 calc(50% - 4px) !important;
        max-width: calc(50% - 4px) !important;
        white-space: normal !important;
        text-align: left !important;
        padding-left: 8px !important;
    }
    /* Headings below hero */
    .pld-pro-hero + h1,
    .pld-pro-hero + * + h1 {
        font-size: 24px !important;
        margin: 32px auto 6px !important;
    }
    .pld-pro-hero + h1 + p {
        font-size: 14px !important;
        margin-bottom: 28px !important;
    }
}

/* ---------- Very small phones (max 380) ---------- */
@media (max-width: 380px) {
    .pld-pro-hero { padding: 30px 18px 28px !important; }
    .pld-pro-hero > div > span:first-child { font-size: 10px !important; padding: 5px 12px !important; }
    .pld-pro-hero p { font-size: 14px !important; margin-bottom: 20px !important; }
    .pld-pro-hero a { font-size: 14px !important; padding: 12px 16px !important; }
    .pld-pro-hero > div > div:last-child { font-size: 11px !important; }
    .pld-pro-hero + h1 { font-size: 22px !important; }
}

/* ============================================================
 * PLD-FULLWIDTH — kill container caps on hero pages
 * ============================================================ */

/* Remove the max-width + padding from every wrapper of the hero */
body.page-template-templatespage-services-php .homepage-wrapper,
body.page-template-templatespage-legal-research-php .homepage-wrapper,
body.page-template-templatespage-lawyer-case-management-php .homepage-wrapper,
body.page-template-page-ai-legal-agent-php .homepage-wrapper,
body.page-template-templatespage-services-php .site-content,
body.page-template-templatespage-services-php .site-content-wrapper,
body.page-template-templatespage-legal-research-php .site-content,
body.page-template-templatespage-lawyer-case-management-php .site-content,
body.page-template-page-ai-legal-agent-php .site-content {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Hero — edge-to-edge, no border radius */
.pld-pro-hero {
    border-radius: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 72px 24px 64px !important;
    box-shadow: none !important;
}

/* Inner content — narrow so text stays readable */
.pld-pro-hero > div {
    max-width: 1080px !important;
    margin: 0 auto !important;
    padding: 0 20px !important;
    box-sizing: border-box !important;
}

/* Section below hero — restore normal width */
body.page-template-templatespage-services-php .homepage-wrapper > *:not(.pld-pro-hero):not([style*="text-align:center"]),
body.page-template-templatespage-legal-research-php .homepage-wrapper > *:not(.pld-pro-hero),
body.page-template-templatespage-lawyer-case-management-php .homepage-wrapper > *:not(.pld-pro-hero),
body.page-template-page-ai-legal-agent-php .homepage-wrapper > *:not(.pld-pro-hero) {
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
}

/* Mobile keeps current stacked layout */
@media (max-width: 640px) {
    .pld-pro-hero {
        border-radius: 0 !important;
        padding: 36px 16px 34px !important;
        margin: 0 !important;
    }
    .pld-pro-hero > div {
        padding: 0 !important;
        max-width: 100% !important;
    }
}
