/* ===========================================
   Purim Ticket & Check-in System Styles
   =========================================== */

/* ---- Shared Layout ---- */
.purim-ticket-container,
.purim-checkin-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
}

/* ---- Header ---- */
.ticket-header,
.checkin-header {
    background: linear-gradient(135deg, #6a1b9a, #8e24aa, #ab47bc);
    color: #fff;
    text-align: center;
    padding: 30px 20px 24px;
    border-radius: 16px 16px 0 0;
}

.ticket-header h1,
.checkin-header h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
}

.ticket-header p,
.checkin-header p {
    margin: 6px 0 0;
    opacity: 0.85;
    font-size: 15px;
}

/* ---- Body ---- */
.ticket-body {
    background: #fff;
    padding: 28px 24px;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.ticket-instruction {
    text-align: center;
    color: #555;
    margin-bottom: 20px;
    font-size: 16px;
}

/* ---- Phone Input ---- */
.phone-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.phone-input-wrapper input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 18px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.phone-input-wrapper input:focus {
    border-color: #8e24aa;
}

/* ---- Buttons ---- */
.ticket-btn {
    display: inline-block;
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    text-decoration: none;
    text-align: center;
    background: linear-gradient(135deg, #6a1b9a, #8e24aa);
    color: #fff;
}

.ticket-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(142, 36, 170, 0.35);
}

.ticket-btn:active {
    transform: translateY(0);
}

.ticket-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ticket-btn-secondary {
    background: #f5f5f5;
    color: #555;
    margin-top: 12px;
    display: block;
    width: 100%;
}

.ticket-btn-secondary:hover {
    background: #eee;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ticket-btn-register {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #2e7d32, #43a047);
}

.ticket-btn-register:hover {
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.35);
}

.ticket-message {
    text-align: center;
    padding: 10px;
    color: #c62828;
    font-size: 14px;
}

/* ---- Status Screens ---- */
.ticket-status-red {
    background: linear-gradient(135deg, #c62828, #e53935, #ef5350);
}

.ticket-status-red .ticket-header {
    background: none;
    padding-bottom: 10px;
}

.ticket-status-red .ticket-body {
    background: rgba(255, 255, 255, 0.95);
    text-align: center;
}

/* ---- Ticket Cards ---- */
.tickets-list {
    padding: 16px;
}

.ticket-card {
    border-radius: 16px;
    padding: 24px 20px;
    margin-bottom: 20px;
    text-align: center;
    transition: all 0.5s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.ticket-card.ticket-status-orange {
    background: linear-gradient(135deg, #e65100, #f57c00, #ff9800);
    color: #fff;
}

.ticket-card.ticket-status-green {
    background: linear-gradient(135deg, #1b5e20, #2e7d32, #43a047);
    color: #fff;
    animation: checkin-pulse 0.6s ease;
}

@keyframes checkin-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.ticket-card-status {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.ticket-card-status .checkin-time {
    font-size: 14px;
    font-weight: 400;
    margin-top: 4px;
    opacity: 0.9;
}

.ticket-card-info h3 {
    margin: 0 0 8px;
    font-size: 20px;
}

.ticket-card-info p {
    margin: 4px 0;
    font-size: 14px;
    opacity: 0.9;
}

.ticket-participants {
    margin-top: 12px;
    text-align: right;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 10px 14px;
}

.ticket-participants strong {
    font-size: 14px;
}

.ticket-participants ul {
    margin: 6px 0 0;
    padding-right: 18px;
    list-style: none;
}

.ticket-participants li {
    font-size: 14px;
    padding: 2px 0;
}

.ticket-participants li::before {
    content: '\2022 ';
    color: rgba(255, 255, 255, 0.7);
}

/* ---- QR Code ---- */
.ticket-qr {
    display: flex;
    justify-content: center;
    margin: 20px 0 12px;
}

.ticket-qr canvas,
.ticket-qr img {
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.checked-in-icon {
    font-size: 80px;
    padding: 20px;
}

.ticket-id {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 8px;
}

/* ---- Guard Check-in Page ---- */
.checkin-tabs {
    display: flex;
    background: #fff;
    border-bottom: 2px solid #e0e0e0;
}

.checkin-tab {
    flex: 1;
    padding: 14px;
    border: none;
    background: none;
    font-size: 16px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.checkin-tab.active {
    color: #6a1b9a;
    border-bottom-color: #6a1b9a;
}

.checkin-tab-content {
    background: #fff;
    min-height: 300px;
}

/* ---- QR Scanner ---- */
.qr-reader-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
}

.qr-reader-container video {
    border-radius: 12px;
}

#qr-reader {
    border: none !important;
}

#qr-reader__scan_region {
    min-height: 250px;
}

.scanner-status {
    text-align: center;
    padding: 16px;
    color: #666;
    font-size: 15px;
}

/* ---- Manual Search ---- */
.manual-search-wrapper {
    display: flex;
    gap: 10px;
    padding: 16px;
}

.manual-search-wrapper input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.manual-search-wrapper input:focus {
    border-color: #8e24aa;
}

.guard-results {
    padding: 0 16px 16px;
}

.guard-result-card {
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 2px solid;
    transition: all 0.3s;
}

.guard-result-card.guard-result-orange {
    border-color: #ff9800;
    background: #fff8e1;
}

.guard-result-card.guard-result-green {
    border-color: #4caf50;
    background: #e8f5e9;
}

.guard-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.guard-result-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.guard-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.badge-orange {
    background: #ff9800;
    color: #fff;
}

.badge-green {
    background: #4caf50;
    color: #fff;
}

.guard-result-card p {
    margin: 4px 0;
    color: #666;
    font-size: 14px;
}

.guard-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.participant-tag {
    background: rgba(106, 27, 154, 0.1);
    color: #6a1b9a;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 13px;
}

.checkin-manual-btn {
    margin-top: 10px;
    width: 100%;
    font-size: 18px;
    padding: 12px;
}

.already-in-text {
    text-align: center;
    color: #2e7d32;
    font-weight: 600;
    font-size: 15px;
    margin-top: 10px;
}

.no-results, .searching {
    text-align: center;
    color: #888;
    padding: 30px 0;
    font-size: 16px;
}

/* ---- Check-in Result Overlay ---- */
.checkin-result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.checkin-result-card {
    background: #fff;
    border-radius: 20px;
    padding: 32px 24px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    animation: result-pop 0.3s ease;
}

@keyframes result-pop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.result-icon {
    font-size: 64px;
    margin-bottom: 12px;
}

.result-success {
    border-top: 6px solid #4caf50;
    border-radius: 20px;
}

.result-success h2 {
    color: #2e7d32;
}

.result-already {
    border-top: 6px solid #ff9800;
    border-radius: 20px;
}

.result-already h2 {
    color: #e65100;
}

.result-error {
    border-top: 6px solid #f44336;
    border-radius: 20px;
}

.result-error h2 {
    color: #c62828;
}

.result-details {
    margin-top: 16px;
}

.result-details h3 {
    font-size: 22px;
    margin: 0 0 8px;
    color: #333;
}

.result-details p {
    color: #666;
    margin: 4px 0;
    font-size: 15px;
}

.result-participants {
    text-align: right;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 10px 14px;
    margin: 12px 0;
}

.result-participants ul {
    margin: 4px 0 0;
    padding-right: 18px;
}

.result-participants li {
    font-size: 14px;
    padding: 2px 0;
}

.result-time {
    font-size: 14px;
    color: #888;
}

.result-reg-id {
    font-size: 12px;
    color: #bbb;
    margin-top: 12px;
}

#checkin-dismiss {
    margin-top: 16px;
    background: #fff;
    color: #333;
    font-size: 18px;
    padding: 14px 40px;
    min-width: 200px;
}

/* ---- Loading Spinner ---- */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #6a1b9a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Responsive ---- */
@media (max-width: 540px) {
    .purim-ticket-container,
    .purim-checkin-container {
        max-width: 100%;
        margin: 0;
    }

    .ticket-header h1,
    .checkin-header h1 {
        font-size: 22px;
    }

    .phone-input-wrapper {
        flex-direction: column;
    }

    .phone-input-wrapper .ticket-btn {
        width: 100%;
    }

    .manual-search-wrapper {
        flex-direction: column;
    }

    .manual-search-wrapper .ticket-btn {
        width: 100%;
    }
}

/* ---- RTL Adjustments ---- */
[dir="rtl"] .ticket-participants ul {
    padding-right: 18px;
    padding-left: 0;
}

[dir="rtl"] .result-participants ul {
    padding-right: 18px;
    padding-left: 0;
}

[dir="rtl"] .guard-result-header {
    flex-direction: row-reverse;
}
