/* ==========================================
   Visual Sitemap Maker - Frontend Styles
   ========================================== */

.vsm-sitemap {
    --vsm-primary: #4a90c6;
    --vsm-text: #1a2744;
    --vsm-line: #1a2744;
    --vsm-bg: #f4f7fb;

    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--vsm-bg);
    background-repeat: no-repeat;
    background-position: center top;
    background-size: cover;
    color: var(--vsm-text);
    padding: 40px 30px;
    position: relative;
    overflow: hidden;
}

/* Decorative corner elements */
.vsm-sitemap::before,
.vsm-sitemap::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M10,10 L40,10 M10,10 L10,40' stroke='%23c8d4e4' stroke-width='1' fill='none'/%3E%3Ccircle cx='40' cy='10' r='2' fill='%23c8d4e4'/%3E%3Ccircle cx='10' cy='40' r='2' fill='%23c8d4e4'/%3E%3Cpath d='M10,20 L30,20 M20,10 L20,30' stroke='%23c8d4e4' stroke-width='0.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    opacity: 0.4;
    pointer-events: none;
}

.vsm-sitemap::before {
    top: 0;
    left: 0;
}

.vsm-sitemap::after {
    bottom: 0;
    right: 0;
    transform: rotate(180deg);
}

.vsm-page {
    max-width: 1440px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    padding: 50px 40px 60px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    position: relative;
    z-index: 1;
}

/* Header */
.vsm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 50px;
    position: relative;
}

.vsm-logo {
    flex: 0 0 auto;
    max-width: 200px;
}

.vsm-logo img {
    max-height: 70px;
    width: auto;
    display: block;
}

.vsm-header-center {
    flex: 1;
    text-align: center;
    padding: 0 20px;
}

.vsm-company-name {
    font-size: 42px;
    font-weight: 700;
    color: var(--vsm-text);
    margin: 0 0 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.vsm-title-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.vsm-line-left,
.vsm-line-right {
    display: block;
    width: 120px;
    height: 2px;
    background: var(--vsm-primary);
    position: relative;
}

.vsm-line-left::after,
.vsm-line-right::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--vsm-primary);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

.vsm-line-left::after {
    right: -3px;
}

.vsm-line-right::after {
    left: -3px;
}

.vsm-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 4px;
    color: var(--vsm-primary);
    text-transform: uppercase;
}

/* Diagram */
.vsm-diagram {
    position: relative;
    overflow: hidden;
}

.vsm-no-items {
    text-align: center;
    color: #8b9bb4;
    padding: 40px;
}

/* Top Level */
.vsm-top-level {
    position: relative;
    z-index: 2;
    padding: 0 10px;
}

.vsm-connector-line-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--vsm-line);
}

.vsm-top-level-items {
    display: grid;
    position: relative;
    padding-top: 40px;
    gap: 15px;
}

.vsm-top-item-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.vsm-top-item {
    width: 100%;
    max-width: 170px;
    min-height: 120px;
    background: #fff;
    border: 1.5px solid #d0d8e4;
    border-radius: 10px;
    padding: 20px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}

/* Dot on top-center of card */
.vsm-top-item::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--vsm-line);
    border-radius: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

/* Vertical line up from dot to horizontal connector */
.vsm-top-item::after {
    content: '';
    position: absolute;
    top: -40px;
    left: 50%;
    width: 2px;
    height: 36px;
    background: var(--vsm-line);
    transform: translateX(-50%);
    z-index: 1;
}

.vsm-top-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.vsm-item-icon-box {
    font-size: 32px;
    color: var(--vsm-text);
    margin-bottom: 12px;
}

.vsm-item-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--vsm-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

.vsm-item-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 10px;
    background: var(--vsm-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
}

.vsm-has-children-indicator {
    margin-top: 10px;
    font-size: 14px;
    color: var(--vsm-primary);
}

/* Sub Level */
.vsm-sub-level {
    display: grid;
    gap: 15px;
    position: relative;
    z-index: 1;
    padding: 0 10px;
}

.vsm-sub-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    padding-top: 30px;
}

.vsm-empty-column {
    visibility: hidden;
}

.vsm-sub-items {
    width: calc(100% + 15px);
    position: relative;
    padding-left: 20px;
    margin-left: 50%;
    box-sizing: border-box;
}

/* Vertical spine — extends up to meet parent, down through all items */
.vsm-sub-items::before {
    content: '';
    position: absolute;
    top: -400px;
    left: 0;
    width: 2px;
    height: calc(100% + 400px);
    background: var(--vsm-line);
}

.vsm-sub-item {
    position: relative;
    margin-bottom: 10px;
}

.vsm-sub-item:last-child {
    margin-bottom: 0;
}

.vsm-sub-card {
    background: #fff;
    border: 1.5px solid #d0d8e4;
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    min-height: 50px;
    position: relative;
    width: fit-content;
    max-width: 100%;
    margin-right: 15px;
}

/* Dot on left edge of card */
.vsm-sub-card::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    width: 8px;
    height: 8px;
    background: var(--vsm-line);
    border-radius: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

/* Horizontal line from spine to dot */
.vsm-sub-card::after {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    width: 20px;
    height: 2px;
    background: var(--vsm-line);
    transform: translateY(-50%);
    z-index: 1;
}

.vsm-sub-icon {
    font-size: 18px;
    color: var(--vsm-primary);
    flex: 0 0 auto;
}

.vsm-sub-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--vsm-text);
    text-transform: uppercase;
    line-height: 1.3;
    flex: 1;
}

.vsm-sub-url {
    display: none;
}

/* Notes Page */
.vsm-notes-page {
    margin-top: 30px;
    page-break-before: always;
}

.vsm-notes {
    font-size: 15px;
    line-height: 1.7;
    color: var(--vsm-text);
}

.vsm-notes h1,
.vsm-notes h2,
.vsm-notes h3,
.vsm-notes h4 {
    color: var(--vsm-text);
    margin-top: 0;
}

.vsm-notes h2 {
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    background: var(--vsm-text);
    color: #fff;
    padding: 15px 20px;
    border-radius: 6px 6px 0 0;
    margin-bottom: 0;
}

.vsm-notes h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.vsm-notes p {
    margin: 0 0 15px;
}

.vsm-notes table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
    border: 1.5px solid #d0d8e4;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.vsm-notes td,
.vsm-notes th {
    padding: 20px;
    border: 1.5px solid #d0d8e4;
    text-align: center;
    vertical-align: top;
}

.vsm-notes td i,
.vsm-notes th i {
    font-size: 36px;
    color: var(--vsm-text);
    margin-bottom: 12px;
    display: block;
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    @page {
        size: landscape;
        margin: 15mm;
    }

    body * {
        visibility: hidden;
    }

    .vsm-sitemap,
    .vsm-sitemap * {
        visibility: visible;
    }

    .vsm-sitemap {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 0;
        background: #fff !important;
        background-image: none !important;
    }

    .vsm-page {
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 20px !important;
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    .vsm-notes-page {
        page-break-before: always;
    }

    .vsm-top-item,
    .vsm-sub-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .vsm-logo img {
        max-height: 50px;
    }

    .vsm-company-name {
        font-size: 28px;
    }

    .vsm-title {
        font-size: 13px;
    }

    .vsm-line-left,
    .vsm-line-right {
        width: 80px;
    }

    .vsm-item-icon-box {
        font-size: 24px;
    }

    .vsm-item-label {
        font-size: 11px;
    }

    .vsm-sub-label {
        font-size: 10px;
    }

    .vsm-sub-icon {
        font-size: 14px;
    }
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media screen and (max-width: 768px) {
    .vsm-page {
        padding: 25px 15px;
    }

    .vsm-header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .vsm-company-name {
        font-size: 24px;
    }

    .vsm-top-level-items,
    .vsm-sub-level {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px;
    }

    .vsm-top-item {
        max-width: 100%;
    }

    .vsm-connector-line-top {
        display: none;
    }

    .vsm-top-item::after {
        display: none;
    }
}
