/* ==========================================================================
   Community Event Ticketing – Frontend Styles
   ========================================================================== */

/* ---- Reset / Base ---- */
.cet-registration-wrap *,
.cet-my-tickets *,
.cet-checkin-wrap * {
    box-sizing: border-box;
}

.cet-registration-wrap,
.cet-my-tickets,
.cet-checkin-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    color: #1a1a1a;
    line-height: 1.6;
    max-width: 820px;
    margin: 0 auto;
    padding: 0 16px 40px;
}

/* =========================================================================
   Shared notice / result
   ========================================================================= */
.cet-notice,
.cet-result,
.cet-success,
.cet-error {
    padding: 13px 18px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    margin-top: 12px;
}

.cet-success,
.cet-result.success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #1b5e20;
}

.cet-error,
.cet-result.error {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    color: #b71c1c;
}

.cet-login-notice {
    font-size: 16px;
}

/* =========================================================================
   Buttons
   ========================================================================= */
.cet-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 600;
    padding: 11px 22px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.18s, box-shadow 0.18s, transform 0.1s;
    line-height: 1;
    white-space: nowrap;
}

.cet-btn:active {
    transform: translateY(1px);
}

.cet-btn-primary {
    background: #1565c0;
    color: #fff;
    box-shadow: 0 2px 6px rgba(21, 101, 192, 0.3);
}

.cet-btn-primary:hover,
.cet-btn-primary:focus {
    background: #0d47a1;
    color: #fff;
    outline: none;
    box-shadow: 0 4px 10px rgba(21, 101, 192, 0.4);
}

.cet-btn-secondary {
    background: #f5f5f5;
    color: #424242;
    border: 2px solid #e0e0e0;
}

.cet-btn-secondary:hover,
.cet-btn-secondary:focus {
    background: #eeeeee;
    outline: none;
}

.cet-btn-cancel {
    background: #ffebee;
    color: #c62828;
    border: 2px solid #ef9a9a;
}

.cet-btn-cancel:hover,
.cet-btn-cancel:focus {
    background: #ffcdd2;
    color: #b71c1c;
    outline: none;
}

/* =========================================================================
   Registration form
   ========================================================================= */
.cet-registration-wrap {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cet-reg-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 18px;
    color: #1565c0;
    border-bottom: 2px solid #e3f2fd;
    padding-bottom: 10px;
}

.cet-capacity {
    font-size: 15px;
    color: #424242;
    background: #f3f9ff;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
}

.cet-full-notice {
    color: #c62828;
    font-weight: 600;
    font-size: 16px;
}

.cet-price {
    font-size: 17px;
    margin-bottom: 14px;
}

.cet-already-registered {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: 10px;
    padding: 16px 20px;
}

.cet-already-registered p {
    margin: 6px 0;
}

/* Form fields */
.cet-reg-form .cet-field {
    margin-bottom: 16px;
}

.cet-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #212121;
}

.cet-input,
.cet-select {
    width: 100%;
    font-size: 16px;
    padding: 11px 14px;
    border: 2px solid #bdbdbd;
    border-radius: 8px;
    color: #212121;
    background: #fafafa;
    transition: border-color 0.2s;
    appearance: none;
}

.cet-input:focus,
.cet-select:focus {
    outline: none;
    border-color: #1565c0;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

/* =========================================================================
   Ticket cards grid
   ========================================================================= */
.cet-my-tickets h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 22px;
    color: #1565c0;
}

.cet-empty {
    font-size: 16px;
    color: #757575;
}

.cet-tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* ---- Individual ticket card ---- */
.cet-ticket-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}

.cet-ticket-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Top color stripe by status */
.cet-status-registered  { border-top: 4px solid #1565c0; }
.cet-status-checked_in  { border-top: 4px solid #2e7d32; }
.cet-status-cancelled   { border-top: 4px solid #bdbdbd; opacity: 0.7; }

.cet-ticket-header {
    background: #f5f5f5;
    padding: 10px 16px;
    display: flex;
    justify-content: flex-end;
}

.cet-ticket-body {
    padding: 16px;
    flex: 1;
}

.cet-ticket-event {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 10px;
    color: #212121;
}

.cet-ticket-date,
.cet-ticket-venue,
.cet-ticket-code {
    font-size: 14px;
    color: #616161;
    margin: 4px 0;
}

.cet-ticket-code code {
    font-family: "Courier New", monospace;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 13px;
    color: #1565c0;
}

/* QR code block */
.cet-ticket-qr {
    padding: 12px 16px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: center;
}

.cet-qr-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.cet-qr-block svg {
    display: block;
}

.cet-qr-code-text {
    font-family: "Courier New", monospace;
    font-size: 12px;
    color: #424242;
    margin: 0;
    text-align: center;
    word-break: break-all;
}

/* Ticket actions */
.cet-ticket-actions {
    padding: 12px 16px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Status badges */
.cet-badge,
.cet-ticket-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: 0.03em;
}

.cet-badge-registered { background: #e3f2fd; color: #1565c0; }
.cet-badge-checked_in { background: #e8f5e9; color: #2e7d32; }
.cet-badge-cancelled  { background: #f5f5f5; color: #757575; }

/* =========================================================================
   Check-in interface
   ========================================================================= */
.cet-checkin-wrap h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 22px;
    color: #1565c0;
}

.cet-checkin-controls {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
}

/* Stats row */
.cet-checkin-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.cet-stat-box {
    flex: 1 1 120px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px 16px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.cet-stat-num {
    display: block;
    font-size: 32px;
    font-weight: 800;
    color: #1565c0;
    line-height: 1;
    margin-bottom: 6px;
}

.cet-stat-label {
    font-size: 13px;
    color: #757575;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Scanner section */
.cet-scanner-section,
.cet-manual-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.cet-scanner-section h3,
.cet-manual-section h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px;
    color: #424242;
}

.cet-scanner-video-wrap {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    max-width: 400px;
    margin-bottom: 14px;
}

.cet-scanner-video {
    width: 100%;
    display: block;
}

.cet-scanner-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Inline form (manual entry) */
.cet-inline-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.cet-inline-form .cet-input {
    flex: 1;
    min-width: 180px;
}

/* Attendee list */
#cet-attendee-list-wrap h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #424242;
}

.cet-attendee-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.cet-attendee-table thead {
    background: #1565c0;
    color: #fff;
}

.cet-attendee-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 13px;
}

.cet-attendee-table tbody tr {
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}

.cet-attendee-table tbody tr:hover {
    background: #f3f9ff;
}

.cet-attendee-table td {
    padding: 10px 14px;
    vertical-align: middle;
}

.cet-attendee-table .cet-badge {
    font-size: 11px;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 600px) {
    .cet-registration-wrap,
    .cet-checkin-controls,
    .cet-scanner-section,
    .cet-manual-section {
        padding: 16px;
    }

    .cet-tickets-grid {
        grid-template-columns: 1fr;
    }

    .cet-checkin-stats {
        gap: 10px;
    }

    .cet-stat-box {
        flex: 1 1 calc(50% - 5px);
    }

    .cet-inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .cet-attendee-table thead {
        display: none;
    }

    .cet-attendee-table tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
    }

    .cet-attendee-table td {
        display: block;
        text-align: right;
        padding: 7px 12px;
    }

    .cet-attendee-table td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: #757575;
        font-size: 12px;
    }
}

/* =========================================================================
   Print – ticket card
   ========================================================================= */
@media print {
    @page {
        margin: 1cm;
    }

    /*
     * When the "Download / Print" button is clicked, JS clones the selected
     * ticket card and appends it directly to <body> with the class
     * .cet-print-clone, then adds .cet-printing to <body>.
     *
     * Using display:none on all other direct body children genuinely removes
     * them from the print layout (unlike visibility:hidden, which keeps their
     * space and causes blank pages).
     */
    body.cet-printing > *:not(.cet-print-clone) {
        display: none !important;
    }

    /* The cloned ticket card – direct child of body, so display:none above
       does not apply to it (it is excluded via :not). */
    body.cet-printing > .cet-print-clone {
        display: flex !important;
        flex-direction: column !important;
        box-shadow: none !important;
        border: 2px solid #000 !important;
        border-radius: 0 !important;
        max-width: 600px !important;
        margin: 0 auto !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* Action buttons are removed from the clone in JS, but hide here as
       a safety net in case a card is somehow printed without the JS path. */
    .cet-ticket-actions {
        display: none !important;
    }
}
