/* ==========================================================================
   Training & Job — Sezione Documentazioni & Viewer Modale Design System
   Brand Palette:
   - Dark Primary: #000000
   - Brand Red: #c8000a (Hover: #a00008, Accent Red: #FE0313)
   - Slate Neutral: #54595F
   - Success Conforme: #16a34a
   - Legacy Tokens: #61CE70, #23A455
   - Light Background: #F8FAFC
   ========================================================================== */

:root {
    --tj-dark: #000000;
    --tj-brand-red: #c8000a;
    --tj-brand-red-hover: #a00008;
    --tj-slate: #54595F;
    --tj-success: #16a34a;
    --tj-green: #61CE70;
    --tj-green-hover: #23A455;
    --tj-red: #FE0313;
}

/* Container and Layout */
.tj-doc-section-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px 60px;
    box-sizing: border-box;
    font-family: 'Roboto', 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #54595F;
}

/* Breadcrumbs */
.tj-breadcrumb-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
    margin-bottom: 25px;
    color: #54595F;
}
.tj-breadcrumb-nav a {
    color: #54595F;
    text-decoration: none;
    transition: color 0.2s ease;
}
.tj-breadcrumb-nav a:hover {
    color: #c8000a;
}
.tj-breadcrumb-nav .tj-sep {
    color: #A0A5AA;
}
.tj-breadcrumb-nav .tj-current {
    color: #c8000a;
    font-weight: 600;
}

/* Page Header */
.tj-header-area {
    margin-bottom: 35px;
}
.tj-header-area.text-center {
    text-align: center;
}
.tj-section-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(200, 0, 10, 0.08);
    color: #c8000a;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 14px;
}
.tj-page-title {
    font-family: 'Roboto', 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 34px;
    line-height: 1.25;
    color: #000000;
    margin: 0 0 15px;
}
.tj-page-lead {
    font-size: 17px;
    line-height: 1.6;
    color: #54595F;
    max-width: 840px;
    margin: 0 0 20px;
}
.tj-header-area.text-center .tj-page-lead {
    margin-left: auto;
    margin-right: auto;
}
.tj-divider {
    width: 70px;
    height: 4px;
    background: #c8000a;
    border-radius: 2px;
    margin: 15px 0 30px;
}
.tj-header-area.text-center .tj-divider {
    margin-left: auto;
    margin-right: auto;
}

/* Category Quick Jump Nav Pills (for Parent Hub) */
.tj-category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 40px;
}
.tj-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 30px;
    color: #000000;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
}
.tj-pill-btn:hover {
    border-color: #c8000a;
    color: #c8000a;
    background: rgba(200, 0, 10, 0.05);
    transform: translateY(-2px);
}
.tj-pill-btn.active {
    background: #c8000a;
    border-color: #c8000a;
    color: #ffffff;
}

/* Overview Category Cards on Hub */
.tj-overview-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}
.tj-overview-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.tj-overview-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
    border-color: #c8000a;
}
.tj-overview-card-header {
    margin-bottom: 16px;
}
.tj-overview-card-title {
    font-size: 21px;
    font-weight: 700;
    color: #000000;
    margin: 10px 0 8px;
}
.tj-overview-card-desc {
    font-size: 14.5px;
    line-height: 1.55;
    color: #54595F;
    margin-bottom: 20px;
}
.tj-overview-card-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #c8000a;
    color: #ffffff;
    padding: 11px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.tj-overview-card-link:hover {
    background: #a00008;
    color: #ffffff;
    transform: translateY(-1px);
}

/* Section Group Container */
.tj-section-group {
    margin-bottom: 50px;
    padding-top: 15px;
}
.tj-group-title {
    font-size: 24px;
    font-weight: 700;
    color: #000000;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.tj-group-desc {
    font-size: 15px;
    color: #54595F;
    margin-bottom: 24px;
}

/* Document Cards Grid */
.tj-doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 20px;
}

/* Document Card Item */
.tj-doc-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-top: 4px solid #c8000a;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-top-color 0.25s ease;
    box-sizing: border-box;
}
.tj-doc-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.1);
    border-top-color: #a00008;
}

/* Badges */
.tj-card-badge-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}
.tj-card-badge {
    background: rgba(200, 0, 10, 0.08);
    color: #c8000a;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.3px;
}
.tj-card-cat-label {
    font-size: 12px;
    font-weight: 600;
    color: #71777d;
    text-transform: uppercase;
}

/* Card Body */
.tj-card-header-flex {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 12px;
}
.tj-pdf-icon-box {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: #fff0f0;
    border: 1px solid #ffd2d2;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c8000a;
}
.tj-pdf-icon-box svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}
.tj-card-title {
    font-size: 17.5px;
    font-weight: 700;
    line-height: 1.35;
    color: #000000;
    margin: 0;
}
.tj-card-subtitle {
    font-size: 14px;
    line-height: 1.5;
    color: #54595F;
    margin: 0 0 12px;
}
.tj-card-scope-box {
    background: #f8fafc;
    border-left: 3px solid #c8000a;
    padding: 8px 12px;
    border-radius: 0 6px 6px 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: #4b5563;
    margin-bottom: 16px;
}

/* File Metadata */
.tj-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 10px 0 16px;
    border-top: 1px solid #f0f2f5;
    border-bottom: 1px solid #f0f2f5;
    margin-bottom: 18px;
    font-size: 12.5px;
    color: #6b7280;
}
.tj-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.tj-meta-item svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}
.tj-status-verified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #16a34a;
    font-weight: 600;
    white-space: nowrap;
}
.tj-status-verified svg {
    width: 15px;
    height: 15px;
    min-width: 15px;
    flex-shrink: 0;
    fill: #16a34a;
}

/* Card Actions */
.tj-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.tj-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 10px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 7px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    box-sizing: border-box;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
}
.tj-btn svg {
    width: 16px;
    height: 16px;
    min-width: 16px;
    flex-shrink: 0;
    fill: currentColor;
}

/* Button 1: Visualizza Online */
.tj-btn-view {
    background: #000000;
    color: #ffffff;
    border: 2px solid #000000;
}
.tj-btn-view:hover {
    background: #c8000a;
    border-color: #c8000a;
    color: #ffffff;
    transform: translateY(-1px);
}

/* Button 2: Scarica File */
.tj-btn-download {
    background: #ffffff;
    color: #c8000a;
    border: 2px solid #c8000a;
}
.tj-btn-download:hover {
    background: #c8000a;
    color: #ffffff;
    transform: translateY(-1px);
}

/* ==========================================================================
   Hybrid Responsive Modal Lightbox
   ========================================================================== */
body.tj-modal-open {
    overflow: hidden !important;
}
.tj-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.tj-modal-overlay.tj-active {
    opacity: 1;
    visibility: visible;
}
.tj-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.tj-modal-window {
    position: relative;
    z-index: 10;
    background: #ffffff;
    border-radius: 12px;
    width: 92vw;
    height: 88vh;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
}

/* Modal Header */
.tj-modal-header {
    background: #000000;
    color: #ffffff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-bottom: 2px solid #c8000a;
}
.tj-modal-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.tj-modal-header-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    color: #c8000a;
}
.tj-modal-header-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}
.tj-modal-title-wrap {
    min-width: 0;
}
.tj-modal-doc-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tj-modal-doc-meta {
    font-size: 12.5px;
    color: #A0A5AA;
}
.tj-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.tj-modal-action-dl {
    background: #c8000a;
    color: #ffffff;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s ease;
}
.tj-modal-action-dl svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}
.tj-modal-action-dl:hover {
    background: #a00008;
    color: #ffffff;
}
.tj-modal-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s ease, transform 0.2s ease;
}
.tj-modal-close-btn:hover {
    color: #c8000a;
    transform: scale(1.15);
}

/* Modal Body */
.tj-modal-body {
    flex: 1;
    position: relative;
    background: #525659;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Desktop iframe */
.tj-modal-iframe-container {
    width: 100%;
    height: 100%;
    flex: 1;
}
.tj-modal-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Mobile Adaptive Container (< 768px / 390x844) */
.tj-mobile-adaptive-container {
    display: none;
    background: #f8fafc;
    padding: 30px 20px;
    text-align: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: 100%;
    box-sizing: border-box;
}
.tj-mobile-adaptive-card {
    max-width: 440px;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}
.tj-mobile-icon-box {
    width: 60px;
    height: 60px;
    background: #fff0f0;
    border: 1px solid #ffd2d2;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: #c8000a;
}
.tj-mobile-icon-box svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}
.tj-mobile-title {
    font-size: 18px;
    font-weight: 700;
    color: #000000;
    margin: 0 0 10px;
    line-height: 1.35;
}
.tj-mobile-meta-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}
.tj-mobile-pill {
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}
.tj-mobile-pill.tj-verified {
    background: rgba(22, 163, 74, 0.12);
    color: #16a34a;
}
.tj-mobile-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}
.tj-btn-mobile-open {
    background: #c8000a;
    color: #ffffff;
    padding: 13px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
}
.tj-btn-mobile-open:hover {
    background: #a00008;
    color: #ffffff;
}
.tj-btn-mobile-download {
    background: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    padding: 11px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
}
.tj-btn-mobile-download:hover {
    background: #000000;
    color: #ffffff;
}
.tj-btn-mobile-close {
    background: #f1f5f9;
    color: #64748b;
    border: none;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}
.tj-btn-mobile-close:hover {
    background: #e2e8f0;
    color: #000000;
}
.tj-mobile-hint {
    font-size: 12px;
    line-height: 1.45;
    color: #64748b;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    padding: 10px 12px;
    margin-top: 14px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
}
.tj-mobile-hint svg {
    width: 16px;
    height: 16px;
    min-width: 16px;
    fill: #c8000a;
    margin-top: 1px;
}

/* ==========================================================================
   Responsive Breakpoints & Mobile Optimization (Tested on 390x844)
   ========================================================================== */
@media (max-width: 767px) {
    .tj-doc-section-wrapper {
        padding: 20px 15px 40px;
    }
    .tj-page-title {
        font-size: 26px;
    }
    .tj-page-lead {
        font-size: 15px;
    }
    .tj-doc-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .tj-card-actions {
        grid-template-columns: 1fr;
    }
    .tj-modal-window {
        width: 95vw;
        height: auto;
        max-height: 92vh;
        border-radius: 14px;
    }
    .tj-modal-header {
        padding: 12px 16px;
    }
    .tj-modal-action-dl {
        display: none; /* In mobile, action is inside adaptive card */
    }
    .tj-modal-iframe-container {
        display: none !important;
    }
    .tj-mobile-adaptive-container {
        display: block !important;
    }
}

@media (min-width: 768px) {
    .tj-mobile-adaptive-container {
        display: none !important;
    }
    .tj-modal-iframe-container {
        display: block !important;
    }
}

/* WordPress wpautop & Specia theme layout hardening */
.tj-doc-section-wrapper p:empty,
.tj-doc-grid > p,
.tj-doc-section-wrapper > p {
    margin: 0;
}
.tj-doc-section-wrapper > p:empty,
.tj-doc-grid > p:empty {
    display: none !important;
}
