﻿/* ================================================================
   PolicyGenerator.css
   Styles for the Document Policy Generator Blazor page.
   Matches the CSCMM Tool / C3iHub design shown in the screenshot.
   ================================================================ */

/* ----------------------------------------------------------------
   CSS Variables / Design Tokens
   ---------------------------------------------------------------- */
:root {
    --pg-navy: #1e2a3a;
    --pg-navy-light: #263548;
    --pg-blue: #2980b9;
    --pg-blue-dark: #1f6997;
    --pg-blue-hover: #246a99;
    --pg-accent: #2980b9;
    --pg-bg-main: #eef0f3;
    --pg-bg-sidebar: #ffffff;
    --pg-bg-content: #eef0f3;
    --pg-border: #dde1e7;
    --pg-border-sidebar: #e2e6ea;
    --pg-text-primary: #1a202c;
    --pg-text-secondary: #6b7a8d;
    --pg-text-muted: #9aa5b4;
    --pg-text-white: #ffffff;
    --pg-step-inactive: #b0bec5;
    --pg-step-active: #2980b9;
    --pg-step-active-bg: #2980b9;
    --pg-step-completed-bg: #2980b9;
    --pg-sidebar-width: 320px;
    --pg-navbar-height: 48px;
    --pg-steps-height: 56px;
    --pg-radius: 6px;
    --pg-radius-lg: 10px;
    --pg-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --pg-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --pg-transition: 0.18s ease;
    --pg-font: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}

/* ----------------------------------------------------------------
   Root Layout
   ---------------------------------------------------------------- */
.pg-root {
    display: flex;
    flex-direction: column;
    height: 100vh;
    font-family: var(--pg-font);
    background: var(--pg-bg-main);
    color: var(--pg-text-primary);
    overflow: hidden;
}

/* ----------------------------------------------------------------
   Navbar
   ---------------------------------------------------------------- */
.pg-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--pg-navy);
    height: var(--pg-navbar-height);
    padding: 0 20px;
    flex-shrink: 0;
    z-index: 100;
}

.pg-navbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pg-navbar-icon {
    display: flex;
    align-items: center;
    color: var(--pg-text-white);
    opacity: 0.9;
}

.pg-navbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--pg-text-white);
    letter-spacing: 0.01em;
}

.pg-navbar-badge {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    padding: 1px 7px;
    letter-spacing: 0.03em;
}

.pg-navbar-right {
    display: flex;
    align-items: center;
}

.pg-breadcrumb {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 0.01em;
}

/* ----------------------------------------------------------------
   Step Progress Bar
   ---------------------------------------------------------------- */
.pg-steps {
    display: flex;
    align-items: center;
    height: var(--pg-steps-height);
    padding: 0 28px;
    background: #ffffff;
    border-bottom: 1px solid var(--pg-border);
    flex-shrink: 0;
    gap: 0;
}

.pg-step {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: default;
}

.pg-step-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--pg-step-inactive);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    transition: background var(--pg-transition);
    flex-shrink: 0;
}

.pg-step.active .pg-step-circle {
    background: var(--pg-step-active-bg);
}

.pg-step.completed .pg-step-circle {
    background: var(--pg-step-completed-bg);
}

.pg-step-label {
    font-size: 13px;
    color: var(--pg-step-inactive);
    font-weight: 500;
    white-space: nowrap;
    transition: color var(--pg-transition);
}

.pg-step.active .pg-step-label {
    color: var(--pg-text-primary);
    font-weight: 600;
}

.pg-step.completed .pg-step-label {
    color: var(--pg-text-secondary);
}

.pg-step-connector {
    flex: 1;
    min-width: 28px;
    max-width: 60px;
    height: 1px;
    background: var(--pg-step-inactive);
    margin: 0 8px;
    transition: background var(--pg-transition);
}

    .pg-step-connector.active {
        background: var(--pg-step-active-bg);
    }

/* ----------------------------------------------------------------
   Main Layout (Sidebar + Content)
   ---------------------------------------------------------------- */
.pg-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ----------------------------------------------------------------
   Sidebar
   ---------------------------------------------------------------- */
.pg-sidebar {
    width: var(--pg-sidebar-width);
    min-width: var(--pg-sidebar-width);
    max-width: var(--pg-sidebar-width);
    background: var(--pg-bg-sidebar);
    border-right: 1px solid var(--pg-border-sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.pg-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 16px 12px;
    border-bottom: 1px solid var(--pg-border);
    flex-shrink: 0;
}

.pg-sidebar-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 600;
    color: var(--pg-text-primary);
}

.pg-sidebar-icon {
    display: flex;
    align-items: center;
}

.pg-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Empty sidebar state */
.pg-empty-sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px 24px;
    gap: 12px;
    text-align: center;
}

.pg-empty-folder-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.pg-empty-text {
    font-size: 13px;
    color: var(--pg-text-secondary);
    line-height: 1.55;
    margin: 0;
}

    .pg-empty-text strong {
        color: var(--pg-blue);
        font-weight: 600;
    }

/* Policy list items */
.pg-policy-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.pg-policy-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    cursor: pointer;
    font-size: 13px;
    color: var(--pg-text-primary);
    border-radius: 0;
    transition: background var(--pg-transition);
    border-left: 3px solid transparent;
}

    .pg-policy-item:hover {
        background: #f4f6f8;
    }

    .pg-policy-item.selected {
        background: #e8f4fd;
        border-left-color: var(--pg-blue);
        color: var(--pg-blue);
        font-weight: 500;
    }

.pg-policy-item-icon {
    display: flex;
    align-items: center;
    opacity: 0.6;
    flex-shrink: 0;
}

.pg-policy-item.selected .pg-policy-item-icon {
    opacity: 1;
    color: var(--pg-blue);
}

.pg-policy-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ----------------------------------------------------------------
   Content Panel
   ---------------------------------------------------------------- */
.pg-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background: var(--pg-bg-content);
}

/* ----------------------------------------------------------------
   Empty State (center panel)
   ---------------------------------------------------------------- */
.pg-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    text-align: center;
    padding: 40px 32px;
    max-width: 420px;
    margin: auto; /* ✅ Centers vertically & horizontally */
}

.pg-empty-doc-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.pg-empty-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--pg-text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

.pg-empty-desc {
    font-size: 14px;
    color: var(--pg-text-secondary);
    line-height: 1.6;
    margin: 0;
}

    .pg-empty-desc strong {
        color: var(--pg-blue);
        font-weight: 600;
    }

/* ----------------------------------------------------------------
   Policy Detail View
   ---------------------------------------------------------------- */
.pg-detail {
    width: 100%;
    height: 100%;
    padding: 32px;
    overflow-y: auto;
}

.pg-detail-header {
    margin-bottom: 20px;
}

    .pg-detail-header h2 {
        font-size: 20px;
        font-weight: 700;
        color: var(--pg-text-primary);
        margin: 0;
    }

.pg-detail-body {
    font-size: 14px;
    color: var(--pg-text-secondary);
}

/* ----------------------------------------------------------------
   Buttons
   ---------------------------------------------------------------- */
/* "+ Policy" button in sidebar header */
.pg-btn-add {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--pg-blue);
    color: var(--pg-text-white);
    border: none;
    border-radius: var(--pg-radius);
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--pg-transition), box-shadow var(--pg-transition);
    font-family: var(--pg-font);
    letter-spacing: 0.01em;
}

    .pg-btn-add:hover {
        background: var(--pg-blue-hover);
        box-shadow: 0 2px 8px rgba(41, 128, 185, 0.35);
    }

    .pg-btn-add:active {
        background: var(--pg-blue-dark);
    }

/* "+ Create New Policy" button (empty state center) */
.pg-btn-create {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--pg-blue);
    color: var(--pg-text-white);
    border: none;
    border-radius: var(--pg-radius);
    padding: 11px 28px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--pg-transition), box-shadow var(--pg-transition), transform var(--pg-transition);
    font-family: var(--pg-font);
    letter-spacing: 0.01em;
    min-width: 200px;
}

    .pg-btn-create:hover {
        background: var(--pg-blue-hover);
        box-shadow: 0 4px 14px rgba(41, 128, 185, 0.40);
        transform: translateY(-1px);
    }

    .pg-btn-create:active {
        background: var(--pg-blue-dark);
        transform: translateY(0);
    }

/* Cancel button (modal) */
.pg-btn-cancel {
    display: inline-flex;
    align-items: center;
    background: transparent;
    color: var(--pg-text-secondary);
    border: 1px solid var(--pg-border);
    border-radius: var(--pg-radius);
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--pg-transition);
    font-family: var(--pg-font);
}

    .pg-btn-cancel:hover {
        background: #f4f6f8;
        color: var(--pg-text-primary);
        border-color: #b8c0cc;
    }

/* ----------------------------------------------------------------
   Modal
   ---------------------------------------------------------------- */
.pg-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 36, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: pg-fade-in 0.18s ease;
}

.pg-modal {
    background: #ffffff;
    border-radius: var(--pg-radius-lg);
    box-shadow: var(--pg-shadow-md);
    width: 420px;
    max-width: 94vw;
    animation: pg-slide-up 0.2s ease;
    overflow: hidden;
}

.pg-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--pg-border);
}

    .pg-modal-header h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 700;
        color: var(--pg-text-primary);
    }

.pg-modal-close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--pg-text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color var(--pg-transition), background var(--pg-transition);
}

    .pg-modal-close:hover {
        color: var(--pg-text-primary);
        background: #f4f6f8;
    }

.pg-modal-body {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pg-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px 18px;
    border-top: 1px solid var(--pg-border);
}

/* ----------------------------------------------------------------
   Form Elements
   ---------------------------------------------------------------- */
.pg-form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--pg-text-primary);
    margin-bottom: 2px;
}

.pg-form-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--pg-border);
    border-radius: var(--pg-radius);
    font-size: 14px;
    font-family: var(--pg-font);
    color: var(--pg-text-primary);
    background: #ffffff;
    outline: none;
    transition: border-color var(--pg-transition), box-shadow var(--pg-transition);
    box-sizing: border-box;
}

    .pg-form-input:focus {
        border-color: var(--pg-blue);
        box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.15);
    }

    .pg-form-input::placeholder {
        color: var(--pg-text-muted);
    }

.pg-form-error {
    font-size: 12px;
    color: #e53e3e;
    margin-top: 2px;
}

/* ----------------------------------------------------------------
   Scrollbar Styling
   ---------------------------------------------------------------- */
.pg-sidebar-body::-webkit-scrollbar,
.pg-content::-webkit-scrollbar,
.pg-detail::-webkit-scrollbar {
    width: 5px;
}

.pg-sidebar-body::-webkit-scrollbar-track,
.pg-content::-webkit-scrollbar-track,
.pg-detail::-webkit-scrollbar-track {
    background: transparent;
}

.pg-sidebar-body::-webkit-scrollbar-thumb,
.pg-content::-webkit-scrollbar-thumb,
.pg-detail::-webkit-scrollbar-thumb {
    background: #cbd2da;
    border-radius: 10px;
}

    .pg-sidebar-body::-webkit-scrollbar-thumb:hover,
    .pg-content::-webkit-scrollbar-thumb:hover,
    .pg-detail::-webkit-scrollbar-thumb:hover {
        background: #a0aab4;
    }

/* ----------------------------------------------------------------
   Animations
   ---------------------------------------------------------------- */
@keyframes pg-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes pg-slide-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ----------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
    :root {
        --pg-sidebar-width: 220px;
    }

    .pg-steps {
        padding: 0 14px;
        gap: 0;
        overflow-x: auto;
    }

    .pg-step-connector {
        min-width: 16px;
    }

    .pg-step-label {
        font-size: 11px;
    }

    .pg-empty-title {
        font-size: 18px;
    }
}

@media (max-width: 560px) {
    .pg-main {
        flex-direction: column;
    }

    .pg-sidebar {
        width: 100%;
        min-width: unset;
        max-width: unset;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--pg-border);
    }
}
/* ----------------------------------------------------------------
   Step 2 – Draft Policy Card
   ---------------------------------------------------------------- */
.pg-content {
    align-items: flex-start; /* override center so card sits at top */
    justify-content: start;
    padding: 32px 24px;
}

.pg-draft-card {
    background: #ffffff;
    border-radius: var(--pg-radius-lg);
    box-shadow: var(--pg-shadow-sm);
    border: 1px solid var(--pg-border);
    padding: 28px 32px 24px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.pg-draft-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.pg-draft-header-icon {
    font-size: 20px;
    line-height: 1;
}

.pg-draft-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--pg-text-primary);
}

.pg-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pg-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.pg-required {
    color: #e53e3e;
    margin-left: 2px;
}

.pg-form-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--pg-border);
    border-radius: var(--pg-radius);
    font-size: 14px;
    font-family: var(--pg-font);
    color: var(--pg-text-primary);
    background: #ffffff;
    outline: none;
    cursor: pointer;
    transition: border-color var(--pg-transition), box-shadow var(--pg-transition);
    appearance: auto;
}

    .pg-form-select:focus {
        border-color: var(--pg-blue);
        box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.15);
    }

.pg-form-textarea {
    width: 100%;
    min-height: 90px;
    padding: 9px 12px;
    border: 1px solid var(--pg-border);
    border-radius: var(--pg-radius);
    font-size: 14px;
    font-family: var(--pg-font);
    color: var(--pg-text-primary);
    background: #ffffff;
    outline: none;
    resize: vertical;
    transition: border-color var(--pg-transition), box-shadow var(--pg-transition);
    box-sizing: border-box;
}

    .pg-form-textarea:focus {
        border-color: var(--pg-blue);
        box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.15);
    }

    .pg-form-textarea::placeholder {
        color: var(--pg-text-muted);
    }

.pg-draft-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.pg-btn-save {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--pg-blue);
    color: var(--pg-text-white);
    border: none;
    border-radius: var(--pg-radius);
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--pg-transition), box-shadow var(--pg-transition);
    font-family: var(--pg-font);
}

    .pg-btn-save:hover {
        background: var(--pg-blue-hover);
        box-shadow: 0 3px 10px rgba(41, 128, 185, 0.35);
    }

    .pg-btn-save:active {
        background: var(--pg-blue-dark);
    }

.pg-draft-hint {
    font-size: 12px;
    color: var(--pg-text-muted);
    margin: 0;
}

@media (max-width: 560px) {
    .pg-form-row {
        grid-template-columns: 1fr;
    }

    .pg-draft-card {
        padding: 20px 16px;
    }
}


.pg-create-layout {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* ----------------------------------------------------------------
   Component Panel (left column)
   ---------------------------------------------------------------- */
.pg-comp-panel {
    width: 340px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid var(--pg-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pg-cp-head {
    padding: 5px 16px 10px;
    border-bottom: 1px solid var(--pg-border);
    flex-shrink: 0;
}

.pg-cp-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--pg-navy);
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pg-cp-subtitle {
    font-size: 12px;
    color: var(--pg-text-muted);
    margin: 0;
}

.pg-cp-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
}

/* ── Section header ── */
.pg-comp-section {
    margin-bottom: 4px;
}

.pg-comp-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--pg-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 4px 0 6px;
    border-bottom: 1px solid var(--pg-border);
    margin-bottom: 10px;
}

/* ── Component toggle cards ── */
.pg-comp-card {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1.5px solid #D5E8F5;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    background: #FAFCFF;
    transition: border-color var(--pg-transition), background var(--pg-transition);
    user-select: none;
}

    .pg-comp-card:hover {
        border-color: var(--pg-blue);
        background: #EBF5FB;
    }

    .pg-comp-card.enabled {
        border-color: var(--pg-blue);
        background: #EBF5FB;
    }

/* Icon box */
.pg-cc-icon {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: #D6EAF8;
    color: var(--pg-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--pg-transition), color var(--pg-transition);
}

    .pg-cc-icon.active {
        background: var(--pg-blue);
        color: #ffffff;
    }

/* Text info */
.pg-cc-info {
    flex: 1;
    overflow: hidden;
}

    .pg-cc-info strong {
        display: block;
        font-size: 13px;
        font-weight: 600;
        color: var(--pg-navy);
        margin-bottom: 1px;
    }

    .pg-cc-info span {
        font-size: 11.5px;
        color: var(--pg-text-muted);
    }

/* ── Toggle switch ── */
.pg-toggle {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: #CBD5E0;
    position: relative;
    flex-shrink: 0;
    transition: background var(--pg-transition);
    cursor: pointer;
}

    .pg-toggle.on {
        background: var(--pg-blue);
    }

.pg-toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: left var(--pg-transition);
}

.pg-toggle.on .pg-toggle-knob {
    left: 18px;
}

/* Small toggle (structure items) */
.pg-toggle.sm {
    width: 30px;
    height: 17px;
}

    .pg-toggle.sm .pg-toggle-knob {
        width: 13px;
        height: 13px;
    }

    .pg-toggle.sm.on .pg-toggle-knob {
        left: 15px;
    }

/* ── Auto-index note ── */
.pg-auto-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    background: #F0F9FF;
    border: 1px solid #BEE3F8;
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 12px;
    color: #2B6CB0;
    margin-top: 4px;
    margin-bottom: 4px;
}

.pg-auto-note-icon {
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.pg-auto-note strong {
    font-weight: 700;
}

/* ── Structure sub-items ── */
.pg-struct-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 8px 16px;
    border-left: 2.5px solid #D5E8F5;
    border-radius: 0 5px 5px 0;
    background: #F8FAFC;
    margin-bottom: 6px;
    cursor: pointer;
    user-select: none;
    transition: border-left-color var(--pg-transition), background var(--pg-transition);
}

    .pg-struct-item:hover {
        border-left-color: var(--pg-blue);
        background: #EBF5FB;
    }

    .pg-struct-item.enabled {
        border-left-color: var(--pg-blue);
        background: #EBF5FB;
    }

.pg-si-icon {
    display: flex;
    align-items: center;
    color: var(--pg-text-secondary);
    width: 20px;
    flex-shrink: 0;
}

.pg-si-label {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--pg-text-primary);
}

/* ── View Document Preview button ── */
.pg-cp-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--pg-border);
    flex-shrink: 0;
}

.pg-btn-view-preview {
    width: 100%;
    background: var(--pg-navy);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--pg-font);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background var(--pg-transition), box-shadow var(--pg-transition);
    letter-spacing: 0.01em;
}

    .pg-btn-view-preview:hover {
        background: var(--pg-navy-light);
        box-shadow: 0 3px 12px rgba(13, 43, 85, 0.35);
    }

    .pg-btn-view-preview:active {
        background: #0d1f30;
    }

/* ----------------------------------------------------------------
   Preview Panel (right column)
   ---------------------------------------------------------------- */
.pg-preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #CBD5E0;
}

/* Preview header bar */
.pg-pv-head {
    background: #ffffff;
    padding: 10px 16px;
    border-bottom: 1px solid var(--pg-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.pg-pv-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--pg-navy);
    margin: 0;
}

.pg-pv-actions {
    display: flex;
    gap: 8px;
}

.pg-pv-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #EBF5FB;
    color: var(--pg-blue);
    border: 1px solid #AED6F1;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--pg-font);
    transition: background var(--pg-transition);
}

    .pg-pv-btn:hover {
        background: #D6EAF8;
    }

/* ── Preview scroll area ── */
.pg-preview-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Empty state */
.pg-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 12px;
    text-align: center;
    min-height: 300px;
}

.pg-preview-empty-icon {
    opacity: 0.7;
}

.pg-preview-empty-text {
    font-size: 13px;
    color: #6b7a8d;
    line-height: 1.65;
    margin: 0;
    max-width: 200px;
}

    .pg-preview-empty-text strong {
        color: var(--pg-navy);
    }

/* ── Generated pages wrapper ── */
.pg-doc-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
}

/* ----------------------------------------------------------------
   Document Page Styles (A4-ish pages)
   Mirrors the original PolicyGenerator.html doc-page styles.
   ---------------------------------------------------------------- */
.doc-page {
    width: 595px;
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    font-family: 'Segoe UI', Calibri, Arial, sans-serif;
    font-size: 11px;
    color: #2C3E50;
    flex-shrink: 0;
}

    /* Page header/footer */
    .doc-page .dp-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 7px 22px 6px;
        border-bottom: 2px solid #2E86C1;
        font-size: 9px;
    }

    .doc-page .dph-l {
        font-weight: 700;
        color: #0D2B55;
    }

    .doc-page .dph-r {
        color: #797D7F;
    }

    .doc-page .dp-body {
        padding: 16px 22px 44px;
    }

    .doc-page .dp-footer {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        justify-content: space-between;
        padding: 5px 22px;
        border-top: 2px solid #2E86C1;
        font-size: 9px;
        color: #797D7F;
        background: #ffffff;
    }

    .doc-page .pg-num {
        color: #2E86C1;
        font-weight: 700;
    }

/* Banner page */
.banner-page {
    min-height: 420px;
    background: #0D2B55;
    display: flex;
    flex-direction: column;
}

.bp-stripe {
    height: 6px;
    background: #D4AC0D;
}

.bp-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 30px 20px;
    text-align: center;
}

.bp-org {
    color: #AED6F1;
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.bp-title {
    color: #ffffff;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
}

.bp-sub {
    color: #D4AC0D;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 18px;
}

.bp-divider {
    width: 180px;
    height: 2px;
    background: #D4AC0D;
    margin: 0 auto 14px;
}

.bp-tagline {
    color: #AED6F1;
    font-size: 9.5px;
    font-style: italic;
}

.bp-bottom {
    background: #1A5276;
    padding: 10px 22px;
    text-align: center;
    font-size: 9.5px;
    color: #AED6F1;
}

/* Content typography */
.lbar {
    background: #0D2B55;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 10px;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

    .lbar.blue {
        background: #1A5276;
    }

.dp-h2 {
    font-size: 11.5px;
    font-weight: 700;
    color: #1A5276;
    border-bottom: 1.5px solid #AED6F1;
    padding-bottom: 3px;
    margin: 10px 0 5px;
}

.dp-p {
    font-size: 10px;
    line-height: 1.6;
    margin-bottom: 6px;
    color: #2C3E50;
}

.dp-ul {
    padding-left: 14px;
    margin-bottom: 6px;
}

    .dp-ul li {
        font-size: 10px;
        line-height: 1.6;
        margin-bottom: 2px;
    }

/* Document table */
.dt {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    margin-bottom: 10px;
}

    .dt th {
        background: #0D2B55;
        color: #ffffff;
        padding: 5px 7px;
        text-align: left;
        font-size: 10px;
    }

    .dt td {
        padding: 5px 7px;
        border: 1px solid #AED6F1;
        vertical-align: top;
    }

    .dt tr:nth-child(odd) td.a {
        background: #D6EAF8;
    }

    .dt tr:nth-child(even) td.a {
        background: #F8F9FA;
    }

    .dt td.lbl {
        background: #D6EAF8;
        font-weight: 700;
        color: #1A5276;
        width: 38%;
    }

    .dt td.val {
        background: #F8F9FA;
    }

    .dt td.b {
        background: #F8F9FA;
    }

/* Index rows */
.idx-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px dotted #AED6F1;
    font-size: 10px;
}

    .idx-row.idx-top {
        font-weight: 700;
        color: #0D2B55;
    }

.ir-pg {
    color: #2E86C1;
    font-weight: 700;
}

/* Classification badges */
.dp-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 8px;
    font-size: 9.5px;
    font-weight: 600;
}

    .dp-badge.conf {
        background: #FCF3CF;
        color: #B7770D;
    }

    .dp-badge.pub {
        background: #D5F5E3;
        color: #1E8449;
    }

    .dp-badge.int {
        background: #D6EAF8;
        color: #1A5276;
    }

    .dp-badge.rest {
        background: #FADBD8;
        color: #C0392B;
    }

/* End-of-document block */
.dp-end {
    background: #F8F9FA;
    border-top: 2px solid #D4AC0D;
    text-align: center;
    padding: 12px;
    margin-top: 14px;
    font-size: 9.5px;
    color: #797D7F;
}

    .dp-end strong {
        display: block;
        color: #0D2B55;
        font-size: 10.5px;
        margin-bottom: 3px;
    }

/* ----------------------------------------------------------------
   Override pg-content alignment for Step 3 (full width/height)
   ---------------------------------------------------------------- */
.pg-content:has(.pg-create-layout) {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
}

/* Responsive tweaks */
@media (max-width: 900px) {
    .pg-comp-panel {
        width: 280px;
    }

    .doc-page {
        width: 100%;
        max-width: 595px;
    }
}

@media (max-width: 640px) {
    .pg-create-layout {
        flex-direction: column;
    }

    .pg-comp-panel {
        width: 100%;
        max-height: 260px;
    }

    .pg-preview-panel {
        flex: 1;
    }
}


.pg-policy-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
}

.pg-policy-actions {
    display: flex; /* always visible */
    margin-left: auto;
    gap: 3px;
    align-items: center;
}

.pg-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    transition: background 0.15s, color 0.15s;
    color: #718096; /* default icon color */
}

    /* Edit — blue */
    .pg-action-btn.edit:hover {
        background: #dbeafe;
        color: #2563eb;
    }

    /* Preview — green */
    .pg-action-btn.preview:hover {
        background: #dcfce7;
        color: #16a34a;
    }

    /* Delete — red */
    .pg-action-btn.delete:hover {
        background: #fee2e2;
        color: #dc2626;
    }

@media print {

    @page {
        size: A4 portrait;
        margin: 0 !important;
    }

    html,
    body {
        width: 210mm !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: white !important;
    }

    /* Hide application UI */
    .pg-navbar,
    .pg-steps,
    .pg-sidebar,
    .pg-comp-panel,
    .pg-pv-head,
    .pg-toolbar,
    .pg-actions,
    .no-print {
        display: none !important;
    }

    /* CRITICAL: remove width, padding and margin restrictions
       from every parent of the document pages */
    .pg-root,
    .pg-main,
    .pg-content,
    .pg-create-layout,
    .pg-preview-panel,
    .pg-preview-wrap,
    .pg-doc-pages {
        display: block !important;
        position: static !important;
        width: 210mm !important;
        min-width: 210mm !important;
        max-width: 210mm !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        transform: none !important;
        translate: none !important;
        box-shadow: none !important;
        border: none !important;
    }

    /* Every document page = exactly one A4 page */
    .doc-page {
        display: block !important;
        position: relative !important;
        width: 210mm !important;
        min-width: 210mm !important;
        max-width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        transform: none !important;
        translate: none !important;
        border: none !important;
        box-shadow: none !important;
        page-break-after: always !important;
        break-after: page !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* =====================================================
       FIRST PAGE — FULL A4 BANNER
       ===================================================== */

    .pg-doc-pages > .doc-page:first-child {
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
        width: 210mm !important;
        min-width: 210mm !important;
        max-width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #0D2B55 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

        /* If banner-page is inside first doc-page */
        .pg-doc-pages > .doc-page:first-child .banner-page {
            display: flex !important;
            flex-direction: column !important;
            position: absolute !important;
            top: 0 !important;
            left: 0 !important;
            right: 0 !important;
            bottom: 0 !important;
            width: 210mm !important;
            min-width: 210mm !important;
            max-width: 210mm !important;
            height: 297mm !important;
            min-height: 297mm !important;
            max-height: 297mm !important;
            margin: 0 !important;
            padding: 0 !important;
            background: #0D2B55 !important;
            box-sizing: border-box !important;
            overflow: hidden !important;
            transform: none !important;
        }

        /* If doc-page itself has banner-page class */
        .pg-doc-pages > .doc-page:first-child.banner-page {
            display: flex !important;
            flex-direction: column !important;
            width: 210mm !important;
            height: 297mm !important;
            margin: 0 !important;
            padding: 0 !important;
            background: #0D2B55 !important;
        }

        /* Yellow top stripe */
        .pg-doc-pages > .doc-page:first-child .bp-stripe {
            display: block !important;
            width: 210mm !important;
            min-width: 210mm !important;
            max-width: 210mm !important;
            height: 6px !important;
            min-height: 6px !important;
            max-height: 6px !important;
            flex: 0 0 6px !important;
            margin: 0 !important;
            padding: 0 !important;
            background: #D4AC0D !important;
            box-sizing: border-box !important;
        }

        /* Main navy area */
        .pg-doc-pages > .doc-page:first-child .bp-content {
            display: flex !important;
            flex-direction: column !important;
            align-items: center !important;
            justify-content: center !important;
            width: 210mm !important;
            min-width: 210mm !important;
            max-width: 210mm !important;
            flex: 1 1 auto !important;
            min-height: 0 !important;
            margin: 0 !important;
            padding: 0 10mm !important;
            background: #0D2B55 !important;
            box-sizing: border-box !important;
            text-align: center !important;
        }

        /* Bottom blue footer */
        .pg-doc-pages > .doc-page:first-child .bp-bottom {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            width: 210mm !important;
            min-width: 210mm !important;
            max-width: 210mm !important;
            height: 14mm !important;
            min-height: 14mm !important;
            max-height: 14mm !important;
            flex: 0 0 14mm !important;
            margin: 0 !important;
            padding: 0 8mm !important;
            background: #1A5276 !important;
            box-sizing: border-box !important;
        }

    /* =====================================================
       NORMAL PAGES — PAGE 2 ONWARD
       ===================================================== */

    .pg-doc-pages > .doc-page:not(:first-child) {
        width: 210mm !important;
        min-width: 210mm !important;
        max-width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

        .pg-doc-pages > .doc-page:not(:first-child) .dp-header {
            width: 100% !important;
            margin: 0 !important;
            padding: 7px 12mm 6px !important;
            box-sizing: border-box !important;
        }

        .pg-doc-pages > .doc-page:not(:first-child) .dp-body {
            width: 100% !important;
            margin: 0 !important;
            padding: 5mm 12mm 15mm !important;
            box-sizing: border-box !important;
        }

        .pg-doc-pages > .doc-page:not(:first-child) .dp-footer {
            position: absolute !important;
            left: 0 !important;
            right: 0 !important;
            bottom: 0 !important;
            width: 100% !important;
            margin: 0 !important;
            padding: 5px 12mm !important;
            box-sizing: border-box !important;
        }

    /* Prevent extra blank page */
    .doc-page:last-child {
        page-break-after: auto !important;
        break-after: auto !important;
    }

    /* Preserve colors */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

        /* Disable animations */
        *,
        *::before,
        *::after {
            animation: none !important;
            transition: none !important;
            filter: none !important;
        }
}