/**
 * QMSPress Ticket Display Styles (ticket-display.css) - v2 Modernized
 * Styles for the [qmspress_ticket_display] shortcode output.
 * Updated for Waiting, Processing, Ready columns.
 * Items now display 3 per row within columns.
 */

/* --- Overall Container --- */
.qmspress-ticket-display-container {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    max-width: 100%;
    box-sizing: border-box;
    color: #343a40;
}

/* --- Date/Time Display --- */
.qmspress-current-datetime {
    text-align: right;
    font-size: 1.4em;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 25px;
    padding-right: 5px;
}

/* --- Main Wrapper for Status Columns --- */
.qmspress-ticket-display-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    justify-content: space-between;
}

/* --- Individual Status Column/Section --- */
.qmspress-queue-section {
    flex: 1;
    min-width: 300px;
    background-color: #ffffff;
    border-radius: 10px;
    padding: 20px 25px;
    border: 1px solid #e9ecef;
    border-top-width: 6px;
    border-top-style: solid;
    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    transition: box-shadow 0.3s ease;
}

/* --- Status-Specific Styling (Top Border Color) --- */
.qmspress-status-waiting { border-top-color: #ffc107; /* Yellow */ }
.qmspress-status-processing { border-top-color: #fd7e14; /* Bootstrap Orange */ }
.qmspress-status-ready { border-top-color: #0dcaf0; /* Bootstrap Cyan/Teal */ }

/* --- Section Title (Waiting, Processing, Ready) --- */
.qmspress-section-title {
    font-size: 1.7em;
    font-weight: 600;
    color: #212529;
    margin: 0 0 20px 0;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

/* --- List Container for Tickets --- */
.qmspress-ticket-queue-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
    /* --- MODIFICATION: Use Flexbox for horizontal layout --- */
    display: flex;
    flex-wrap: wrap; /* Allow items to wrap to next row */
    gap: 10px; /* Space between ticket items */
    /* Removed flex-grow, overflow-y, max-height */
    /* --- END MODIFICATION --- */
}

/* --- Individual Ticket Item --- */
.qmspress-ticket-item {
    background: #ffffff;
    /* --- MODIFICATION: Set width for 3 columns --- */
    width: calc(33.333% - 7px); /* Adjust calculation based on gap: (gap * (items_per_row - 1) / items_per_row) -> (10px * 2 / 3) approx 7px */
    /* --- END MODIFICATION --- */
    margin: 0; /* Remove vertical margin, rely on gap */
    padding: 12px 10px; /* Adjust padding */
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    /* --- MODIFICATION: Center content within the item --- */
    display: flex; /* Use flex to center content */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    text-align: center;
    box-sizing: border-box; /* Include padding/border in width calculation */
    min-height: 50px; /* Give items a minimum height */
    /* Removed flex-direction: column */
    /* --- END MODIFICATION --- */
}

/* --- Ticket Information Container (Might not be needed if only showing number) --- */
.qmspress-ticket-info {
    /* --- MODIFICATION: Adjust if needed, maybe remove if item has direct content --- */
    display: flex;
    /* Removed flex-direction and gap */
    width: auto; /* Allow content to determine width */
    /* --- END MODIFICATION --- */
}

/* --- Ticket Details (Number) --- */
.qmspress-ticket-number {
    font-size: 1.6em; /* Increase size slightly */
    color: #343a40; /* Darker color for number */
    line-height: 1.2; /* Adjust line height */
    word-wrap: break-word;
    display: block; /* Ensure it takes up space */
    /* Removed specific selectors for folder, patient, counter unless needed */
}

.qmspress-ticket-number strong {
    font-weight: 700; /* Make number bold */
    color: #212529;
    margin: 0; /* Remove margin if only number is shown */
}

/* Remove label styling if labels are not used */
.qmspress-ticket-number::before,
.qmspress-folder-number::before,
.qmspress-patient-name::before,
.qmspress-counter-name::before {
    content: none; /* Hide pseudo-element labels */
}
/* Remove direct label span styling if not used */
.qmspress-served-ticket-label,
.qmspress-served-folder-label,
span.qmspress-ticket-label,
span.qmspress-folder-label,
span.qmspress-patient-label,
span.qmspress-counter-label {
    display: none; /* Hide label spans */
}


/* --- Special List Item States --- */
.qmspress-ticket-item.qmspress-loading,
.qmspress-ticket-item.qmspress-no-tickets,
.qmspress-ticket-item.qmspress-error {
    /* --- MODIFICATION: Ensure these span full width --- */
    width: 100%;
    /* --- END MODIFICATION --- */
    justify-content: center;
    font-style: italic;
    color: #6c757d;
    background: #e9ecef;
    border: 1px dashed #adb5bd;
    padding: 25px;
    text-align: center;
    font-size: 1.1em;
    min-height: 80px;
    align-items: center;
}

.qmspress-ticket-item.qmspress-error {
    color: #dc3545;
    border-color: #dc3545;
    background-color: #f8d7da;
    font-style: normal;
    font-weight: 500;
}

/* --- Responsive Adjustments --- */
@media only screen and (max-width: 992px) {
    .qmspress-ticket-display-wrap {
        gap: 20px;
    }
     .qmspress-queue-section {
        min-width: calc(50% - 10px);
    }
     /* --- MODIFICATION: Adjust item width for 2 columns --- */
    .qmspress-ticket-item {
        width: calc(50% - 5px); /* 2 items per row */
        padding: 10px;
    }
     /* --- END MODIFICATION --- */
}

@media only screen and (max-width: 768px) {
    .qmspress-ticket-display-wrap {
        flex-direction: column;
        gap: 20px;
    }
    .qmspress-queue-section {
        min-width: 100%;
        /* Removed max-height */
    }
    .qmspress-section-title {
        font-size: 1.6em;
    }
    /* Keep 2 items per row even when columns stack */
    .qmspress-ticket-item {
         width: calc(50% - 5px); /* Still 2 items per row */
         font-size: 1.2em; /* Adjust font size within item */
    }
     .qmspress-ticket-number {
        font-size: 1.4em; /* Adjust number size */
    }
    .qmspress-current-datetime {
        font-size: 1.3em;
        text-align: center;
        margin-bottom: 20px;
    }
}

@media only screen and (max-width: 480px) {
     .qmspress-ticket-display-container {
         padding: 15px;
     }
     .qmspress-queue-section {
         padding: 15px;
     }
     /* --- MODIFICATION: Adjust item width for 1 or 2 columns --- */
     .qmspress-ticket-item {
         width: calc(50% - 5px); /* Try keeping 2 per row */
         /* Or uncomment below for 1 per row on very small screens */
         /* width: 100%; */
         padding: 8px;
         min-height: 40px;
     }
     /* --- END MODIFICATION --- */
     .qmspress-section-title {
         font-size: 1.4em;
         padding-bottom: 10px;
         margin-bottom: 15px;
     }
     .qmspress-ticket-number {
         font-size: 1.3em; /* Adjust number size */
     }
     .qmspress-current-datetime {
         font-size: 1.1em;
     }
}