/**
 * Cafe Planet Menu - A4 Sheet Styles
 * Scoped under .cp-wp-wrapper to avoid polluting WordPress themes
 */

.cp-wp-wrapper {
    font-family: var(--cp-font-body, 'Plus Jakarta Sans', sans-serif);
    color: var(--cp-color-primary, #221710);
    max-width: 100%;
    margin: 0 auto;
    padding: 10px 0 40px 0;
    box-sizing: border-box;
}

/* Sheets container */
.cp-pages-viewport {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    width: 100%;
    overflow-x: auto;
    padding: 10px 0;
}

/* Exact A4 Portrait Dimensions */
.cp-a4-sheet {
    width: 210mm;
    min-width: 210mm;
    max-width: 210mm;
    height: 297mm;
    min-height: 297mm;
    max-height: 297mm;
    padding: 10mm 12mm 8mm 12mm;
    background-color: var(--cp-color-bg, #FFFFFF);
    color: var(--cp-color-primary, #221710);
    font-family: var(--cp-font-body, 'Plus Jakarta Sans', sans-serif);
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    box-shadow: 0 14px 35px -5px rgba(0, 0, 0, 0.22);
    border: 1px solid #E8DFD5;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Background image layer */
.cp-a4-bg-layer {
    position: absolute;
    inset: 0;
    background-image: var(--cp-bg-image, none);
    background-size: var(--cp-bg-size, cover);
    background-position: var(--cp-bg-pos-x, 50%) var(--cp-bg-pos-y, 50%);
    background-repeat: no-repeat;
    opacity: var(--cp-bg-opacity, 0.14);
    pointer-events: none;
    z-index: 0;
}

/* Scalable Content Layer (Auto-fits to A4 height automatically) */
.cp-a4-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    transform: scale(var(--page-auto-scale, 1));
    transform-origin: top center;
}

/* Header bar */
.cp-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2.5px solid currentColor;
    padding-bottom: 4px;
    margin-bottom: 10px;
    font-weight: 900;
    font-size: 11.5px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.cp-top-brand {
    color: var(--cp-color-accent, #8C5D2C);
    letter-spacing: 2.5px;
    font-family: var(--cp-font-heading, 'Playfair Display', serif);
    font-size: 14px;
    font-weight: 800;
}

/* 2-Column Grid */
.cp-grid-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
}

.cp-col {
    display: flex;
    flex-direction: column;
    min-height: 40px;
}

/* Category Block */
.cp-sec-block {
    margin-bottom: var(--cp-sec-gap, 12px);
    position: relative;
}

.cp-sec-title {
    font-family: var(--cp-font-heading, 'Playfair Display', serif);
    font-size: var(--cp-heading-size, 17.5px);
    font-weight: 800;
    border-bottom: 1.5px solid currentColor;
    padding-bottom: 2px;
    margin: 0 0 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    line-height: 1.2;
    position: relative;
}

/* Category Line Style Variants */
.cp-wp-wrapper[data-line-style="solid"] .cp-sec-title {
    border-bottom: 1.5px solid currentColor;
}

.cp-wp-wrapper[data-line-style="double"] .cp-sec-title {
    border-bottom: 3.5px double currentColor;
    padding-bottom: 3px;
}

.cp-wp-wrapper[data-line-style="dotted"] .cp-sec-title {
    border-bottom: 2px dotted currentColor;
    padding-bottom: 3px;
}

.cp-wp-wrapper[data-line-style="dashed"] .cp-sec-title {
    border-bottom: 1.5px dashed currentColor;
    padding-bottom: 3px;
}

.cp-wp-wrapper[data-line-style="accent"] .cp-sec-title {
    border-bottom: 2.5px solid var(--cp-color-accent, #8C5D2C);
    padding-bottom: 3px;
}

.cp-wp-wrapper[data-line-style="short"] .cp-sec-title {
    border-bottom: none;
    padding-bottom: 5px;
}

.cp-wp-wrapper[data-line-style="short"] .cp-sec-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 44px;
    height: 2.5px;
    background-color: var(--cp-color-accent, #8C5D2C);
    border-radius: 2px;
}

.cp-wp-wrapper[data-line-style="boxed"] .cp-sec-title {
    border-bottom: none;
    background: rgba(140, 93, 44, 0.1);
    border-left: 3.5px solid var(--cp-color-accent, #8C5D2C);
    padding: 3px 8px;
    border-radius: 0 5px 5px 0;
}

.cp-wp-wrapper[data-line-style="none"] .cp-sec-title {
    border-bottom: none;
    padding-bottom: 0;
}

.cp-sec-subtitle {
    font-size: 9.5px;
    font-family: var(--cp-font-body, 'Plus Jakarta Sans', sans-serif);
    opacity: 0.75;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
}

/* Items List */
.cp-items-list {
    display: flex;
    flex-direction: column;
    gap: var(--cp-item-gap, 5px);
}

.cp-item-row {
    padding: 2px 4px;
    margin: 0 -4px;
    border-radius: 4px;
    position: relative;
    transition: background-color 0.15s ease;
}

.cp-item-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: var(--cp-item-size, 10.5px);
    font-weight: 800;
    line-height: 1.25;
}

.cp-item-name {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px;
    font-weight: 800;
}

/* Dot Leader & Variants */
.cp-leader {
    flex-grow: 1;
    border-bottom: 1.5px dotted currentColor;
    opacity: 0.35;
    margin: 0 6px;
    min-width: 12px;
}

.cp-wp-wrapper[data-leader-style="dashed"] .cp-leader {
    border-bottom: 1px dashed currentColor;
    opacity: 0.35;
}

.cp-wp-wrapper[data-leader-style="solid"] .cp-leader {
    border-bottom: 1px solid currentColor;
    opacity: 0.2;
}

.cp-wp-wrapper[data-leader-style="none"] .cp-leader {
    border-bottom: none;
}

.cp-price {
    color: var(--cp-color-accent, #8C5D2C);
    font-weight: 800;
    white-space: nowrap;
    font-size: var(--cp-item-size, 10.5px);
}

.cp-desc {
    font-size: var(--cp-desc-size, 9px);
    opacity: 0.85;
    margin: 2px 0 0 0;
    line-height: 1.25;
    font-weight: 500;
}

.cp-allergen {
    font-size: 8px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 0 4px;
    border-radius: 3px;
    margin-left: 4px;
    font-weight: 700;
    white-space: nowrap;
}

.cp-box-note {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.16);
    padding: 5px 8px;
    border-radius: 5px;
    font-size: 8.5px;
    line-height: 1.35;
    font-weight: 600;
    position: relative;
}

.cp-lunch-bar {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.16);
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 8.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
    font-weight: 600;
    position: relative;
}

/* Footer Section */
.cp-sheet-footer {
    margin-top: 8px;
}

.cp-footer-info {
    border-top: 2px solid currentColor;
    padding-top: 5px;
    font-size: 8.5px;
    text-align: center;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    line-height: 1.3;
}

.cp-allergen-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.14);
    margin-top: 4px;
    padding-top: 3px;
    font-size: 7.5px;
    text-align: center;
    opacity: 0.85;
}

/* Printable Rules */
@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body * {
        visibility: hidden;
    }

    .cp-pages-viewport,
    .cp-pages-viewport * {
        visibility: visible;
    }

    .cp-pages-viewport {
        position: absolute;
        left: 0;
        top: 0;
        width: 210mm !important;
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
    }

    .no-print,
    .cp-studio-bar,
    .cp-inline-actions,
    .cp-cat-toolbar,
    .cp-item-toolbar,
    .cp-col-add-zone,
    .cp-add-bar-placeholder {
        display: none !important;
    }

    .cp-a4-sheet {
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        page-break-after: always !important;
        break-after: page !important;
        outline: none !important;
    }
}
