/**
 * Pallet Labels Module CSS - Modern Design
 *
 * @package Karis_Labels
 */

/* ==== CSS VARIABLES ==== */
:root {
    --primary: #CB94B3;
    --primary-hover: #b8829f;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --bg: #f8fafc;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 16px;
    --radius-sm: 10px;
}

/* ==== FORM CONTAINER ==== */
.form-container {
    max-width: 500px;
    margin: 40px auto;
    padding: 0 20px;
}

.pallet-upload-form {
    background: none;
    border: none;
    box-shadow: none;
}

/* ==== FORM HEADER ==== */
.form-header {
    text-align: center;
    margin-bottom: 32px;
}

.form-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px 0;
}

.form-header p {
    font-size: 16px;
    color: var(--text-muted);
    margin: 0;
}

/* ==== UPLOAD CARD ==== */
.upload-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 48px 24px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary);
    background: #fdf2f8;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.upload-text {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 15px;
}

.upload-link {
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
}

.upload-link:hover {
    text-decoration: underline;
}

.upload-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}

.upload-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ==== FILE SELECTED ==== */
.file-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.file-selected .file-icon {
    font-size: 24px;
}

.file-selected .file-name {
    font-weight: 600;
    color: var(--text);
    font-size: 15px;
}

.file-selected .file-remove {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--text-muted);
    color: var(--white);
    border: none;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.file-selected .file-remove:hover {
    background: #ef4444;
}

/* ==== SUBMIT BUTTON ==== */
.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff !important;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%) !important;
    border: none !important;
    border-radius: var(--radius) !important;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(203, 148, 179, 0.4);
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(203, 148, 179, 0.5);
    color: #ffffff !important;
}

.btn-submit:disabled {
    background: #d1d5db !important;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* ==== TURNSTILE ==== */
.turnstile-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

/* ==== FOCUS RESET ==== */
*:focus,
*:focus-visible {
    outline: none !important;
}

/* ==== TOAST NOTIFICATIONS ==== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 320px;
    max-width: 450px;
    animation: slideIn 0.3s ease;
    backdrop-filter: blur(10px);
}

.toast-error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    border-left: 4px solid #c0392b;
    color: white;
}

.toast-warning {
    background: linear-gradient(135deg, #f9ca24 0%, #f0932b 100%);
    border-left: 4px solid #d68910;
    color: #2c3e50;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex-grow: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    color: inherit;
    padding: 0;
    margin: -4px -4px 0 0;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ==== RESULT CONTAINER ==== */
.result-container {
    width: 100%;
    max-width: none !important;
    margin: 0;
    padding: 0;
}

/* ==== LABELS CONTAINER ==== */
.labels-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    max-width: none !important;
}

.label-pair {
    width: 100%;
    min-height: 400px;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    box-sizing: border-box;
    padding: 20px;
    margin: 0;
    gap: 20px;
    page-break-inside: avoid;
}

.label {
    width: 49%;
    min-height: inherit;
    box-sizing: border-box;
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    margin: 0;
    position: relative;
    background: var(--white);
}

.label-content {
    width: 100%;
    width: -webkit-fill-available;
    font-size: 13px;
    line-height: 1.6;
    flex-grow: 1;
}

/* ==== LOGO & NAME ==== */
.logo-and-name-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.klant-logo {
    max-height: 50px;
}

.name-column {
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
    text-align: right;
}

.alias-subline {
    display: block;
    font-weight: 400;
    font-size: 12px;
    color: var(--text);
    opacity: 0.7;
    margin-top: 2px;
}

/* ==== ORDER INFO ==== */
.order-info {
    margin-top: 20px;
    padding-left: 5vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    flex-grow: 1;
    width: 100%;
}

.order-info p {
    font-size: 20px;
    margin: 0 0 12px;
    color: var(--text);
}

.order-info .so-number {
    padding: 5px 10px;
    border-radius: 10px;
    border-width: 5px;
    border-style: solid;
}

.order-info strong {
    font-size: 28pt;
}

/* ==== CIRCLE & PALLET SECTION ==== */
.circle-and-ordernr-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 10px;
    width: -webkit-fill-available;
    margin-top: auto;
    padding-top: 20px;
}

.circle-column {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.color-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 30px solid;
    box-sizing: border-box;
    background: none;
}

.country-circle {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    border: 3px solid var(--text);
    border-radius: 50%;
}

.pallet-info {
    margin-left: auto;
    font-size: 14px;
    text-align: right;
}

.pallet-info strong {
    font-size: 28pt;
}

h1 {
    display: none;
}

p {
    margin: 0 0 6px;
}

/* ==== PRINT HEADER ==== */
.print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
    margin: 60px 0 0 0 !important;
}

.print-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.print-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.generation-info {
    font-size: 14px;
    color: var(--text-muted);
}

.new-file-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}

.new-file-link:hover {
    text-decoration: underline;
}

.print-tip {
    font-size: 13px;
    color: #9ca3af;
}

.print-button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff !important;
    background: var(--primary) !important;
    border: none !important;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.print-button:hover {
    background: var(--primary-hover) !important;
    transform: translateY(-1px);
    color: #ffffff !important;
}

.print-button:focus {
    outline: none !important;
}

.site-main,
.entry-content {
    padding: 0 !important;
    margin: 0 !important;
}

/* ==== PRINT STYLES ==== */
@media print {
    @page {
        size: A4 landscape;
        margin: 0 !important;
    }

    :root {
        --page-w: 297mm;
        --page-h: 210mm;
        --outer-pad: 6mm;
        --gutter: 6mm;
        --label-pad: 12mm;
    }

    html, body {
        margin: 0 !important;
        padding: 0 !important;
        width: 297mm !important;
        height: 210mm !important;
        overflow: visible !important;
    }

    .print-header,
    .print-header.alignfull,
    .karis-back-link,
    .karis-form-header,
    h1,
    #toast-container,
    #form-container,
    .form-container,
    .upload-card,
    .pallet-upload-form,
    .alignfull:not(.labels-container) {
        display: none !important;
        height: 0 !important;
        min-height: 0 !important;
        width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        page-break-before: avoid !important;
        page-break-after: avoid !important;
        break-before: avoid !important;
        break-after: avoid !important;
    }

    /* Reset alle parent containers */
    #page,
    #content,
    #primary,
    main,
    article,
    .entry-content,
    .site-main,
    .pallet-labels-output {
        width: 297mm !important;
        max-width: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }

    .result-container {
        width: 297mm !important;
        max-width: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }

    .labels-container {
        width: 297mm !important;
        max-width: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }

    .label-pair {
        display: flex !important;
        align-items: stretch !important;
        justify-content: space-between !important;
        width: 297mm !important;
        height: 210mm !important;
        max-height: 210mm !important;
        padding: 0 var(--outer-pad) !important;
        gap: var(--gutter) !important;
        box-sizing: border-box !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        overflow: hidden !important;
    }

    .label-pair:first-child {
        page-break-before: avoid !important;
        break-before: avoid !important;
    }

    .label-pair + .label-pair {
        page-break-before: always !important;
        break-before: page !important;
    }

    .label {
        width: calc((var(--page-w) - 2 * var(--outer-pad) - var(--gutter)) / 2) !important;
        height: var(--page-h) !important;
        padding: var(--label-pad) !important;
        border: none !important;
        box-shadow: none !important;
        display: flex !important;
        flex-direction: column !important;
        row-gap: 8mm !important;
        box-sizing: border-box;
        overflow: hidden !important;
        position: relative !important;
    }

    .label-content {
        max-height: none !important;
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
        flex-grow: 1 !important;
    }

    .logo-and-name-container {
        margin-bottom: 4mm !important;
        padding-bottom: 4mm !important;
    }

    .klant-logo {
        max-height: 15mm !important;
    }

    .name-column {
        font-size: 14pt !important;
    }

    .alias-subline {
        font-size: 10pt !important;
        margin-top: 1mm !important;
    }

    .order-info {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        margin-top: 8mm !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: flex-start !important;
        padding-left: 10mm !important;
    }

    .order-info p {
        font-size: 14pt !important;
        margin: 0 0 4mm 0 !important;
    }

    .order-info strong {
        font-size: 18pt !important;
    }

    .order-info .so-number {
        padding: 2mm 4mm !important;
        border-width: 3px !important;
    }

    .circle-and-ordernr-container {
        display: flex !important;
        align-items: center !important;
        gap: 3mm !important;
        min-height: 20mm !important;
        width: -webkit-fill-available !important;
    }

    .color-circle,
    .country-circle {
        width: 16mm !important;
        height: 16mm !important;
        border-radius: 50% !important;
    }

    .color-circle {
        border-width: 8mm !important;
        border-style: solid !important;
        box-sizing: border-box !important;
    }

    .country-circle {
        border: 2px solid #000 !important;
        font-size: 12pt !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .pallet-info {
        margin-left: auto !important;
        text-align: right !important;
    }

    .pallet-info strong {
        font-size: 20pt !important;
    }

    .label,
    .label * {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
