/* WooCommerce Guest Documents - Frontend Styles
   v1.2.1 — Palazzo Zurloni design + high specificity overrides
   ============================================================= */

/* My Account content background */
#my-account-menu-tab .woocommerce-MyAccount-content,
#my-account-menu-tab~.woocommerce-MyAccount-content {
    background: #fff;
}

.woocommerce-account .wc-guest-documents-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

/* =============================================
   NOTICES
   ============================================= */
.wc-guest-documents-wrapper .wc-guest-docs-notices {
    margin-bottom: 20px;
}

.wc-guest-documents-wrapper .wc-guest-docs-notice {
    padding: 12px 20px;
    margin-bottom: 15px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    font-size: 14px;
    line-height: 1.5;
}

.wc-guest-documents-wrapper .wc-guest-docs-notice.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.wc-guest-documents-wrapper .wc-guest-docs-notice.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.wc-guest-documents-wrapper .wc-guest-docs-notice.info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* =============================================
   INTRO TEXT
   ============================================= */
.wc-guest-documents-wrapper .wc-guest-docs-intro {
    margin-bottom: 25px;
    font-size: 14px;
    line-height: 1.7;
    color: #555;
}

/* =============================================
   UPLOAD SECTION
   ============================================= */
.wc-guest-documents-wrapper .wc-guest-docs-upload-section {
    background: #fafaf8;
    padding: 30px;
    border: 1px solid #e8e4dc;
    margin-bottom: 35px;
    border-radius: 0;
}

.wc-guest-documents-wrapper .wc-guest-docs-upload-section h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 25px 0;
    padding: 0 0 12px 0;
    border-bottom: 2px solid #241F1C;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wc-guest-documents-wrapper .wc-guest-docs-form .form-row {
    margin-bottom: 18px;
}

.wc-guest-documents-wrapper .wc-guest-docs-form .form-row-first,
.wc-guest-documents-wrapper .wc-guest-docs-form .form-row-last {
    width: 48% !important;
    display: inline-block !important;
    vertical-align: top;
    float: none !important;
}

.wc-guest-documents-wrapper .wc-guest-docs-form .form-row-first {
    margin-right: 2%;
}

.wc-guest-documents-wrapper .wc-guest-docs-form .form-row-wide {
    width: 100% !important;
}

.wc-guest-documents-wrapper .wc-guest-docs-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wc-guest-documents-wrapper .wc-guest-docs-form label .required {
    color: #c0392b;
}

.wc-guest-documents-wrapper .wc-guest-docs-form input[type="text"],
.wc-guest-documents-wrapper .wc-guest-docs-form select {
    width: 100% !important;
    padding: 12px 14px !important;
    border: 1px solid #d5d0c8 !important;
    background: #fff !important;
    font-size: 14px !important;
    color: #333 !important;
    transition: border-color 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0 !important;
    height: auto !important;
    line-height: normal !important;
    box-sizing: border-box !important;
}

.wc-guest-documents-wrapper .wc-guest-docs-form input[type="text"]:focus,
.wc-guest-documents-wrapper .wc-guest-docs-form select:focus {
    border-color: #ab916c !important;
    outline: none;
    box-shadow: 0 0 0 1px rgba(36, 31, 28, 0.15);
}

/* Select arrow */
.wc-guest-documents-wrapper .wc-guest-docs-form select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23241F1C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 18px !important;
    padding-right: 40px !important;
}

.wc-guest-documents-wrapper .wc-guest-docs-form input[type="file"] {
    width: 100% !important;
    padding: 10px !important;
    border: 1px dashed #d5d0c8 !important;
    background: #fff !important;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.3s ease;
    box-sizing: border-box !important;
}

.wc-guest-documents-wrapper .wc-guest-docs-form input[type="file"]:hover {
    border-color: #ab916c !important;
}

.wc-guest-documents-wrapper .wc-guest-docs-form .description {
    display: block;
    margin-top: 6px;
    color: #888;
    font-size: 12px;
    line-height: 1.4;
}

/* Upload Button */
.wc-guest-documents-wrapper .wc-guest-docs-btn {
    background-color: #ab916c !important;
    color: #fff !important;
    padding: 14px 30px !important;
    border: none !important;
    cursor: pointer;
    font-size: 14px !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    display: inline-block;
    border-radius: 0 !important;
    height: auto !important;
    line-height: normal !important;
}

.wc-guest-documents-wrapper .wc-guest-docs-btn:hover {
    background-color: #3a3330 !important;
    color: #fff !important;
}

.wc-guest-documents-wrapper .wc-guest-docs-loading {
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
}

.wc-guest-documents-wrapper .wc-guest-docs-loading .spinner {
    float: none;
    margin: 0;
}

/* =============================================
   DOCUMENTS LIST SECTION
   ============================================= */
.wc-guest-documents-wrapper .wc-guest-docs-list-section {
    margin-top: 40px;
}

.wc-guest-documents-wrapper .wc-guest-docs-list-section h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #ab916c;
    margin: 0 0 25px 0;
    padding: 0 0 12px 0;
    border-bottom: 2px solid #ab916c;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wc-guest-documents-wrapper .wc-guest-docs-no-documents {
    padding: 40px 30px;
    text-align: center;
    background: #fafaf8;
    border: 1px dashed #d5d0c8;
    color: #888;
    font-size: 14px;
}

/* =============================================
   TABLE — DESKTOP
   ============================================= */
.wc-guest-documents-wrapper table.wc-guest-docs-table.shop_table {
    border-collapse: collapse !important;
    border: 1px solid #e8e4dc !important;
    width: 100% !important;
    table-layout: auto !important;
    background: #fff;
}

.wc-guest-documents-wrapper table.wc-guest-docs-table.shop_table thead th {
    background-color: #ab916c !important;
    color: #fff !important;
    padding: 12px 14px !important;
    text-align: left !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none !important;
    white-space: nowrap;
}

.wc-guest-documents-wrapper table.wc-guest-docs-table.shop_table td {
    padding: 14px !important;
    border-bottom: 1px solid #eee !important;
    border-left: none !important;
    border-right: none !important;
    vertical-align: middle;
    font-size: 14px;
}

.wc-guest-documents-wrapper table.wc-guest-docs-table.shop_table tbody tr:hover {
    background-color: #fafaf8;
}

/* Column widths */
.wc-guest-documents-wrapper .wc-guest-docs-table th:nth-child(1),
.wc-guest-documents-wrapper .wc-guest-docs-table td:nth-child(1) { width: 18%; }
.wc-guest-documents-wrapper .wc-guest-docs-table th:nth-child(2),
.wc-guest-documents-wrapper .wc-guest-docs-table td:nth-child(2) { width: 15%; }
.wc-guest-documents-wrapper .wc-guest-docs-table th:nth-child(3),
.wc-guest-documents-wrapper .wc-guest-docs-table td:nth-child(3) { width: 20%; }
.wc-guest-documents-wrapper .wc-guest-docs-table th:nth-child(4),
.wc-guest-documents-wrapper .wc-guest-docs-table td:nth-child(4) { width: 12%; }
.wc-guest-documents-wrapper .wc-guest-docs-table th:nth-child(5),
.wc-guest-documents-wrapper .wc-guest-docs-table td:nth-child(5) { width: 10%; }
.wc-guest-documents-wrapper .wc-guest-docs-table th:nth-child(6),
.wc-guest-documents-wrapper .wc-guest-docs-table td:nth-child(6) { width: 25%; }

/* Cell content */
.wc-guest-documents-wrapper .wc-guest-docs-table .guest-name {
    display: block;
    font-weight: 600;
    color: #ab916c;
}

.wc-guest-documents-wrapper .wc-guest-docs-table .doc-type {
    display: block;
    color: #555;
}

.wc-guest-documents-wrapper .wc-guest-docs-table .file-info {
    display: block;
    word-break: break-word;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wc-guest-documents-wrapper .wc-guest-docs-table .file-info small {
    display: block;
    color: #888;
    font-size: 11px;
    margin-top: 3px;
}

/* Badges */
.wc-guest-documents-wrapper .wc-guest-docs-table .badge {
    display: inline-block;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 0;
}

.wc-guest-documents-wrapper .badge-success {
    background-color: #d4edda;
    color: #155724;
}

.wc-guest-documents-wrapper .badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.wc-guest-documents-wrapper .badge-sent {
    background-color: #d1ecf1;
    color: #0c5460;
}

.wc-guest-documents-wrapper .badge-approved {
    background-color: #d4edda;
    color: #155724;
}

.wc-guest-documents-wrapper .badge-rejected {
    background-color: #f8d7da;
    color: #721c24;
}

/* Action buttons */
.wc-guest-documents-wrapper .wc-guest-docs-table td.actions {
    white-space: nowrap;
}

.wc-guest-documents-wrapper .wc-guest-docs-table .button.btn-edit,
.wc-guest-documents-wrapper .wc-guest-docs-table .button.btn-delete,
.wc-guest-documents-wrapper .wc-guest-docs-table button.wc-guest-docs-edit,
.wc-guest-documents-wrapper .wc-guest-docs-table button.wc-guest-docs-delete {
    margin-right: 5px !important;
    margin-bottom: 5px !important;
    padding: 0 12px !important;
    font-size: 12px !important;
    height: 32px !important;
    line-height: 32px !important;
    display: inline-block !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.wc-guest-documents-wrapper .wc-guest-docs-table button.wc-guest-docs-edit,
.wc-guest-documents-wrapper .wc-guest-docs-table .button.btn-edit {
    background-color: #5B514C !important;
    color: #fff !important;
    border: none !important;
}

.wc-guest-documents-wrapper .wc-guest-docs-table button.wc-guest-docs-edit:hover,
.wc-guest-documents-wrapper .wc-guest-docs-table .button.btn-edit:hover {
    background-color: #3a3330 !important;
    color: #fff !important;
}

.wc-guest-documents-wrapper .wc-guest-docs-table button.wc-guest-docs-delete,
.wc-guest-documents-wrapper .wc-guest-docs-table .button.btn-delete {
    background-color: #c0392b !important;
    color: #fff !important;
    border: none !important;
}

.wc-guest-documents-wrapper .wc-guest-docs-table button.wc-guest-docs-delete:hover,
.wc-guest-documents-wrapper .wc-guest-docs-table .button.btn-delete:hover {
    background-color: #a93226 !important;
    color: #fff !important;
}

/* =============================================
   SEND ALL BUTTON
   ============================================= */
.wc-guest-documents-wrapper .wc-guest-docs-actions {
    margin-top: 30px;
    padding: 25px;
    text-align: center;
}

.wc-guest-documents-wrapper .btn-send {
    background-color: #ab916c !important;
    color: #fff !important;
    padding: 16px 40px !important;
    border: none !important;
    cursor: pointer;
    font-size: 14px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all 0.3s ease;
    display: inline-block;
    width: 100%;
    max-width: 400px;
    border-radius: 0 !important;
    height: auto !important;
    line-height: normal !important;
    box-shadow: none !important;
}

.wc-guest-documents-wrapper .btn-send:hover {
    background-color: #3a3330 !important;
    color: #fff !important;
}

/* =============================================
   MODAL
   ============================================= */
.wc-guest-docs-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
}

.wc-guest-docs-modal .modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 35px;
    border: 1px solid #e8e4dc;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.wc-guest-docs-modal .close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    transition: color 0.2s;
}

.wc-guest-docs-modal .close:hover {
    color: #ab916c;
}

.wc-guest-docs-modal h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: #ab916c;
    margin: 0 0 20px 0;
}

.wc-guest-docs-modal .btn-cancel {
    background-color: #888;
    color: #fff;
    margin-left: 10px;
}

.wc-guest-docs-modal .btn-cancel:hover {
    background-color: #666;
}

/* =============================================
   RESPONSIVE — TABLET & MOBILE (< 768px)
   ============================================= */
@media screen and (max-width: 1180px) {

    /* Form: inputs full width */
    .wc-guest-documents-wrapper .wc-guest-docs-form .form-row-first,
    .wc-guest-documents-wrapper .wc-guest-docs-form .form-row-last {
        width: 100% !important;
        display: block !important;
        margin-right: 0 !important;
    }

    .wc-guest-documents-wrapper .wc-guest-docs-upload-section {
        padding: 20px;
    }

    .wc-guest-documents-wrapper .wc-guest-docs-btn {
        width: 100% !important;
        text-align: center;
    }

    /* ==========================================
       TABLE → CARD LAYOUT
       ========================================== */
    .wc-guest-documents-wrapper table.wc-guest-docs-table.shop_table,
    .wc-guest-documents-wrapper table.wc-guest-docs-table {
        border: none !important;
        background: transparent !important;
    }

    .wc-guest-documents-wrapper table.wc-guest-docs-table.shop_table thead,
    .wc-guest-documents-wrapper .wc-guest-docs-table thead {
        display: none !important;
    }

    .wc-guest-documents-wrapper table.wc-guest-docs-table.shop_table tbody,
    .wc-guest-documents-wrapper .wc-guest-docs-table tbody {
        display: block !important;
    }

    .wc-guest-documents-wrapper table.wc-guest-docs-table.shop_table tbody tr,
    .wc-guest-documents-wrapper .wc-guest-docs-table tbody tr {
        display: block !important;
        margin-bottom: 20px !important;
        border: 1px solid #e8e4dc !important;
        background: #fff !important;
        padding: 0 !important;
    }

    /* Reset column widths for mobile */
    .wc-guest-documents-wrapper .wc-guest-docs-table td:nth-child(n) {
        width: 100% !important;
    }

    /* Every td becomes a grid row: label | value */
    .wc-guest-documents-wrapper table.wc-guest-docs-table.shop_table td,
    .wc-guest-documents-wrapper .wc-guest-docs-table td {
        display: grid !important;
        grid-template-columns: 110px 1fr !important;
        gap: 8px !important;
        align-items: start !important;
        padding: 10px 15px !important;
        border-bottom: 1px solid #f0f0f0 !important;
        border-left: none !important;
        border-right: none !important;
        border-top: none !important;
        text-align: left !important;
        font-size: 13px !important;
        word-break: break-word;
        min-height: auto !important;
    }

    .wc-guest-documents-wrapper .wc-guest-docs-table td:last-child {
        border-bottom: none !important;
    }

    /* Data-label pseudo-element */
    .wc-guest-documents-wrapper table.wc-guest-docs-table.shop_table td::before,
    .wc-guest-documents-wrapper .wc-guest-docs-table td::before {
        content: attr(data-label) !important;
        font-weight: 700 !important;
        font-size: 11px !important;
        color: #ab916c !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px;
        padding-top: 2px;
        display: block !important;
        float: none !important;
    }

    .wc-guest-documents-wrapper .wc-guest-docs-table td[data-label="Guest"]::before {
        mix-blend-mode: difference;
    }

    /* First cell (Ospite) → card header */
    .wc-guest-documents-wrapper .wc-guest-docs-table td:first-child {
        background: #ab916c !important;
        color: #fff !important;
        padding: 14px 15px !important;
        display: block !important;
    }

    .wc-guest-documents-wrapper .wc-guest-docs-table td:first-child .guest-name {
        color: #fff !important;
        font-size: 15px;
        font-weight: 600;
        letter-spacing: 0.5px;
    }

    /* File info — allow full wrapping */
    .wc-guest-documents-wrapper .wc-guest-docs-table .file-info {
        max-width: none !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: unset !important;
        font-size: 12px;
    }

    /* Actions cell — flex buttons, no grid label */
    .wc-guest-documents-wrapper table.wc-guest-docs-table.shop_table td.actions,
    .wc-guest-documents-wrapper .wc-guest-docs-table td.actions {
        display: flex !important;
        gap: 8px !important;
        justify-content: center !important;
        padding: 12px 15px !important;
        background: #f5f3ef !important;
        white-space: normal !important;
    }

    .wc-guest-documents-wrapper .wc-guest-docs-table td.actions::before {
        display: none !important;
    }

    .wc-guest-documents-wrapper .wc-guest-docs-table td.actions button {
        flex: 1 !important;
        text-align: center !important;
        margin: 0 !important;
    }

    /* Send all button */
    .wc-guest-documents-wrapper .btn-send {
        max-width: 100% !important;
    }

    .wc-guest-documents-wrapper .badge-success {
        max-width: 150px;
        text-align: center;
    }
}

/* =============================================
   RESPONSIVE — SMALL MOBILE (< 480px)
   ============================================= */
@media screen and (max-width: 480px) {

    .wc-guest-documents-wrapper {
        padding: 10px 0;
    }

    .wc-guest-documents-wrapper .wc-guest-docs-upload-section {
        padding: 15px;
    }

    .wc-guest-documents-wrapper .wc-guest-docs-upload-section h3,
    .wc-guest-documents-wrapper .wc-guest-docs-list-section h3 {
        font-size: 1.25rem;
    }

    /* Prevent iOS zoom on focus */
    .wc-guest-documents-wrapper .wc-guest-docs-form input[type="text"],
    .wc-guest-documents-wrapper .wc-guest-docs-form select {
        font-size: 16px !important;
    }

    .wc-guest-documents-wrapper .wc-guest-docs-table td {
        grid-template-columns: 95px 1fr !important;
        padding: 8px 12px !important;
    }

    .wc-guest-docs-modal .modal-content {
        margin: 10% auto;
        padding: 20px;
    }
}