/**
 * WC Print Production - Frontend Styles
 */

/* ===== Printfiles Section ===== */
.woocommerce-order-printfiles {
    margin: 2em 0;
}

.woocommerce-order-printfiles h2 {
    margin-bottom: 1em;
}

/* ===== Printfiles List (Card Layout) ===== */
.wcpp-printfiles-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.wcpp-printfile-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    transition: border-color 0.2s ease;
}

.wcpp-printfile-item:hover {
    border-color: #0073aa;
}

.wcpp-printfile-item.wcpp-item--pending {
    border-left: 4px solid #ffb900;
}

.wcpp-printfile-item.wcpp-item--uploaded {
    border-left: 4px solid #46b450;
}

/* Item Header */
.wcpp-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.wcpp-item-product {
    font-size: 1em;
}

.wcpp-item-product strong {
    color: #333;
}

.wcpp-item-qty {
    color: #666;
    font-size: 0.9em;
    margin-left: 5px;
}

/* Item Upload Area */
.wcpp-item-upload {
    margin-top: 10px;
}

/* Upload Hint */
.wcpp-upload-hint {
    margin-top: 15px;
    color: #666;
    text-align: center;
}

/* ===== Upload Form ===== */
.wcpp-upload-form {
    position: relative;
}

/* Thumbnail 100×100 (Druckdatei, „contain“) */
.wcpp-file-thumb-wrap {
    flex-shrink: 0;
    width: 100px; /* Fallback; PHP setzt Größe inline bei abweichendem Filter */
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border: 1px solid #c3dccc;
    border-radius: 6px;
    overflow: hidden;
    box-sizing: border-box;
}

.wcpp-file-thumb {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    vertical-align: middle;
}

.wcpp-file-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 15px;
    background: #f0f9f0;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    margin-bottom: 10px;
}

.wcpp-file-revision-notice {
    flex: 1 1 100%;
    margin: 0;
    padding: 8px 10px;
    background: #fff8e6;
    border: 1px solid #e6d4a8;
    border-radius: 6px;
    font-size: 0.88em;
    color: #5c4a21;
    line-height: 1.35;
}

.wcpp-file-icon {
    font-size: 1.3em;
}

.wcpp-file-name {
    font-weight: 500;
    word-break: break-all;
    flex: 1;
}

.wcpp-file-size {
    color: #666;
    font-size: 0.85em;
}

.wcpp-file-actions {
    display: flex;
    gap: 8px;
}

.wcpp-file-actions .button {
    font-size: 0.85em;
    padding: 5px 12px;
}

.wcpp-upload-form .button.alt.wcpp-delete-btn,
.wcpp-file-actions .button.alt.wcpp-delete-btn {
    background-color: var(--accent-color, #ff0078) !important;
    color: #fff !important;
    border-color: var(--accent-color, #ff0078) !important;
}

.wcpp-upload-form .button.alt.wcpp-delete-btn:hover,
.wcpp-upload-form .button.alt.wcpp-delete-btn:focus,
.wcpp-file-actions .button.alt.wcpp-delete-btn:hover,
.wcpp-file-actions .button.alt.wcpp-delete-btn:focus {
    filter: brightness(0.92);
    color: #fff !important;
}

/* Upload Area */
.wcpp-upload-area {
    position: relative;
}

.wcpp-upload-area.wcpp-hidden {
    display: none;
}

.wcpp-file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.wcpp-dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 25px 20px;
    text-align: center;
    background: #fafafa;
    transition: all 0.2s ease;
}

.wcpp-dropzone:hover,
.wcpp-upload-area.wcpp-dragover .wcpp-dropzone {
    border-color: #0073aa;
    background: #f0f7fc;
}

.wcpp-dropzone-icon {
    display: block;
    font-size: 2em;
    margin-bottom: 8px;
    opacity: 0.7;
}

.wcpp-dropzone-text {
    display: block;
    font-size: 0.95em;
    color: #555;
    margin-bottom: 5px;
}

.wcpp-dropzone-info {
    display: block;
    font-size: 0.8em;
    color: #888;
}

/* Progress */
.wcpp-progress {
    margin-top: 12px;
    position: relative;
    height: 22px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.wcpp-progress.wcpp-hidden {
    display: none;
}

.wcpp-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--accent-color, #ff0078);
    transition: width 0.3s ease;
}

.wcpp-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75em;
    font-weight: 600;
    color: #333;
}

/* Message */
.wcpp-message {
    margin-top: 10px;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.9em;
}

.wcpp-message.wcpp-hidden {
    display: none;
}

.wcpp-message.wcpp-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.wcpp-message.wcpp-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* File Display (read-only) */
.wcpp-file-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.wcpp-file-display .wcpp-file-icon {
    font-size: 1.2em;
}

.wcpp-file-display .wcpp-file-meta {
    color: #666;
    font-size: 0.85em;
}

.wcpp-no-file {
    color: #999;
    font-style: italic;
}

/* ===== Produkt-Referenz (Warenkorb / Kasse) ===== */
.wcpp-product-reference-field {
    margin-top: 0.75em;
    max-width: 28em;
}

.wcpp-product-reference-field--checkout {
    margin-top: 0.5em;
}

.wcpp-product-reference-label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 0.25em;
    color: #333;
}

.wcpp-product-reference-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/*
 * WooCommerce (u. a. Storefront): .woocommerce-order-details :last-child { margin-bottom: 0 }
 * trifft unsere Hinweise als einziges Kindelement — unteren Abstand wiederherstellen.
 */
.woocommerce .woocommerce-order-details .wcpp-missing-files-notice:last-child,
.woocommerce .woocommerce-order-details .wcpp-production-release-notice:last-child,
.woocommerce .woocommerce-customer-details .wcpp-missing-files-notice:last-child,
.woocommerce .woocommerce-customer-details .wcpp-production-release-notice:last-child,
.woocommerce .woocommerce-order-downloads .wcpp-missing-files-notice:last-child,
.woocommerce .woocommerce-order-downloads .wcpp-production-release-notice:last-child {
    margin-bottom: 1.25rem;
}

.woocommerce .woocommerce-order-details .wcpp-order-progress:last-child,
.woocommerce .woocommerce-customer-details .wcpp-order-progress:last-child,
.woocommerce .woocommerce-order-downloads .wcpp-order-progress:last-child {
    margin-bottom: 1.25rem;
}

/* ===== Bestell-Fortschritt (Kundenkonto) ===== */
.wcpp-order-progress-slot:empty {
    display: none;
}

.wcpp-order-progress {
    margin: 0 0 1.25rem;
    padding: 0;
    box-sizing: border-box;
}

/* Grauer Pillen-Track; farbiger Fill = aktueller Status, Breite = Fortschritt */
.wcpp-order-progress__track {
    position: relative;
    width: 100%;
    height: 10px;
    margin-bottom: 0.5rem;
    background: #e3e3e3;
    border-radius: 9999px;
    overflow: hidden;
    box-sizing: border-box;
}

.wcpp-order-progress__fill {
    height: 100%;
    min-width: 0;
    border-radius: 9999px;
    box-sizing: border-box;
    transition: width 0.35s ease, background-color 0.25s ease;
}

.wcpp-order-progress__fill--accent {
    background-color: var(--accent-color, #ff0078) !important;
}

.wcpp-order-progress__current {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
    color: #222;
    text-align: left;
}

/* Kompakt (Bestellübersicht): volle Spaltenbreite */
.wcpp-order-progress--compact {
    margin: 0;
    width: 100%;
    max-width: 100%;
}

.wcpp-order-progress--compact .wcpp-order-progress__track {
    margin-bottom: 0.35rem;
}

.wcpp-order-progress--compact .wcpp-order-progress__current {
    font-size: 0.82rem;
}

/* Tabellenzelle „Status“: Balken über ganze verfügbare Breite */
.woocommerce-orders-table__cell-order-status .wcpp-order-progress,
table.woocommerce-orders-table td.order-status .wcpp-order-progress,
.woocommerce-account-orders .woocommerce-orders-table td.order-status .wcpp-order-progress,
.woocommerce-account-content table.shop_table_responsive.woocommerce-account-orders-table td[data-title="Status"] .wcpp-order-progress,
.woocommerce table.my_account_orders td.order-status .wcpp-order-progress {
    width: 100%;
    max-width: 100%;
    display: block;
    box-sizing: border-box;
}

/* Storniert: Icon + Text in Akzentfarbe, kompakt, Label leicht */
.wcpp-account-order-status--cancelled {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    vertical-align: middle;
    font-size: 0.82rem;
    color: var(--accent-color, #ff0078);
}

.wcpp-account-order-status--cancelled .wcpp-account-order-status__icon {
    flex-shrink: 0;
    display: inline-flex;
    line-height: 0;
    color: inherit;
}

.wcpp-account-order-status--cancelled .wcpp-account-order-status__icon svg {
    display: block;
    width: 1.2em;
    height: 1.2em;
}

.wcpp-account-order-status--cancelled .wcpp-account-order-status__label {
    font-weight: lighter;
    color: inherit;
}

/* ===== Missing Files Notice (Kundenkonto / Bestelldetails) ===== */
.wcpp-missing-files-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    margin: 1rem 0 1.25rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border: 2px solid var(--accent-color, #ff0078);
    border-radius: 6px;
    box-sizing: border-box;
    color: #333;
}

.wcpp-missing-files-notice__icon {
    flex-shrink: 0;
    line-height: 0;
    color: var(--accent-color, #ff0078);
}

.wcpp-missing-files-notice__icon svg {
    display: block;
}

.wcpp-missing-files-notice__body {
    flex: 1;
    min-width: 0;
}

.wcpp-missing-files-notice__title {
    display: block;
    margin: 0 0 0.35em;
    font-size: 1em;
    color: var(--accent-color, #ff0078);
}

.wcpp-missing-files-notice__text {
    margin: 0;
    line-height: 1.5;
    color: #333;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .wcpp-printfile-item {
        padding: 12px;
    }
    
    .wcpp-item-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .wcpp-dropzone {
        padding: 20px 15px;
    }
    
    .wcpp-dropzone-icon {
        font-size: 1.8em;
    }
    
    .wcpp-file-info {
        flex-wrap: wrap;
    }
    
    .wcpp-file-actions {
        width: 100%;
        margin-top: 8px;
    }
}

/* ===== Status Indicators (used in Order Column) ===== */
.wcpp-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 500;
}

.wcpp-badge-complete {
    background: #d4edda;
    color: #155724;
}

.wcpp-badge-partial {
    background: #fff3cd;
    color: #856404;
}

.wcpp-badge-none {
    background: #f8f9fa;
    color: #6c757d;
}

/* ===== Kundenfreigabe (Hinweis — gleiche Bildsprache wie .wcpp-missing-files-notice) ===== */
.wcpp-production-release-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    margin: 1rem 0 1.25rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border: 2px solid var(--accent-color, #ff0078);
    border-radius: 6px;
    box-sizing: border-box;
    color: #333;
}

.wcpp-production-release-notice--rejected {
    border-color: #c9a227;
}

.wcpp-production-release-notice--rejected .wcpp-production-release-notice__icon {
    color: #b8860b;
}

.wcpp-production-release-notice--rejected .wcpp-production-release-notice__title {
    color: #8a6d00;
}

.wcpp-production-release-notice__icon {
    flex-shrink: 0;
    line-height: 0;
    color: var(--accent-color, #ff0078);
}

.wcpp-production-release-notice__icon svg {
    display: block;
}

.wcpp-production-release-notice__body {
    flex: 1;
    min-width: 0;
}

.wcpp-production-release-notice__title {
    display: block;
    margin: 0 0 0.35em;
    font-size: 1em;
    color: var(--accent-color, #ff0078);
}

.wcpp-production-release-notice__text {
    margin: 0;
    line-height: 1.5;
    color: #333;
}

.wcpp-production-release-notice__actions {
    margin: 0.85em 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* Primär-Aktion wie Woo „In den Warenkorb“ / checkout.alt */
.wcpp-production-release-notice .button.wcpp-production-release-open {
    background-color: var(--accent-color, #ff0078) !important;
    color: #fff !important;
    border-color: var(--accent-color, #ff0078) !important;
}

.wcpp-production-release-notice .button.wcpp-production-release-open:hover,
.wcpp-production-release-notice .button.wcpp-production-release-open:focus {
    filter: brightness(0.92);
    color: #fff !important;
}

body.wcpp-modal-open {
    overflow: hidden;
}

.wcpp-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.wcpp-modal.is-open {
    display: flex;
}

.wcpp-modal[hidden] {
    display: none !important;
}

.wcpp-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.wcpp-modal__panel {
    position: relative;
    z-index: 1;
    max-width: 520px;
    width: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    padding: 1.35em 1.5em 1.5em;
    box-sizing: border-box;
}

.wcpp-modal__title {
    margin: 0 0 0.65em;
    font-size: 1.2em;
    line-height: 1.3;
}

.wcpp-modal__text {
    margin: 0 0 1.25em;
    line-height: 1.5;
    color: #333;
}

.wcpp-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.wcpp-modal__actions .button {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    white-space: normal;
}

.wcpp-modal__actions .wcpp-production-release-yes {
    background-color: var(--accent-color, #ff0078) !important;
    color: #fff !important;
    border-color: var(--accent-color, #ff0078) !important;
}

.wcpp-modal__actions .wcpp-production-release-yes:hover,
.wcpp-modal__actions .wcpp-production-release-yes:focus {
    filter: brightness(0.92);
    color: #fff !important;
}
