/* ==========================================================================
   Joshua User Portal Stylesheet
   ========================================================================== */

:root {
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-elevated: #f1f5f9;
    --border-light: #e2e8f0;
    --border-focus: #3b82f6;

    --text-heading: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    
    --success: #059669;
    --success-bg: #ecfdf5;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --warning: #d97706;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

body.user-body {
    font-family: var(--font-family);
    background-color: var(--bg-page);
    color: var(--text-body);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
}

.user-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

/* Navbar */
.user-navbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.nav-container {
    min-height: 64px;
    height: auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    box-sizing: border-box;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-heading);
}

.user-nav-logo {
    height: 36px;
    width: auto;
    max-width: 220px;
    max-height: 42px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

.brand-spark {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 500;
}

.brand-title strong {
    font-weight: 800;
    color: var(--primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-link {
    text-decoration: none;
    color: var(--text-body);
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.15s;
}

.nav-link:hover {
    color: var(--primary);
}

.text-warning {
    color: var(--warning) !important;
}

.btn-outline-user {
    padding: 8px 16px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-heading);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.15s;
}

.btn-outline-user:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: var(--primary-light);
}

/* Flash alerts */
.flash-container {
    margin-top: 20px;
}

.user-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    margin-bottom: 20px;
}

.alert-success {
    background-color: var(--success-bg);
    border: 1px solid #a7f3d0;
    color: var(--success);
}

.alert-error {
    background-color: var(--danger-bg);
    border: 1px solid #fecaca;
    color: var(--danger);
}

.alert-icon {
    font-weight: 800;
    font-size: 1.2rem;
}

/* Hero Section */
.hero-section {
    padding: 60px 0 40px;
    text-align: center;
}

.hero-content {
    max-width: 680px;
    margin: 0 auto 36px;
}

.hero-tag {
    display: inline-block;
    padding: 6px 14px;
    background-color: var(--primary-light);
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 20px;
    margin-bottom: 16px;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-heading);
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 14px;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Lookup Card */
.lookup-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 36px;
    max-width: 780px;
    margin: 0 auto;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.lookup-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 20px;
}

.lookup-form {
    display: flex;
    gap: 12px;
}

.lookup-input {
    flex: 1;
    padding: 14px 20px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s;
}

.lookup-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.lookup-btn {
    padding: 14px 28px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s;
}

.lookup-btn:hover {
    background-color: var(--primary-hover);
}

/* Search Results */
.search-result-box {
    margin-top: 28px;
    text-align: left;
}

.result-card.found {
    background-color: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: var(--radius-md);
    padding: 24px;
}

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

.result-status-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 800;
}

.status-confirmed { background-color: #dbeafe; color: #1e40af; }
.status-checked_in { background-color: #d1fae5; color: #065f46; }
.status-pending { background-color: #fef3c7; color: #92400e; }

.result-code {
    font-family: monospace;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.result-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-heading);
}

.result-org {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.seating-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.seating-info-box {
    background-color: white;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.info-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.info-val {
    font-size: 1rem;
    color: var(--text-heading);
}

.info-val.highlight {
    color: var(--primary);
}

.result-card.not-found {
    background-color: #fff7ed;
    border: 1.5px solid #fed7aa;
    border-radius: var(--radius-md);
    padding: 28px;
    text-align: center;
}

.not-found-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.result-card.not-found h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #9a3412;
    margin-bottom: 6px;
}

/* Registration Section */
.section-register {
    padding: 60px 0;
}

.register-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 48px;
    align-items: start;
}

.register-info h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-heading);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.register-info p {
    color: var(--text-muted);
    margin-bottom: 32px;
}

.feature-bullets {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feature-item {
    display: flex;
    gap: 16px;
}

.f-icon {
    width: 44px;
    height: 44px;
    background-color: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.feature-item strong {
    display: block;
    color: var(--text-heading);
    font-size: 0.95rem;
}

.feature-item p {
    font-size: 0.85rem;
    margin-bottom: 0;
}

.register-form-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.register-form-card h3 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-heading);
    margin-bottom: 24px;
}

.user-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-heading);
}

.form-control,
.form-select {
    padding: 11px 16px;
    background-color: #ffffff !important;
    border: 1.5px solid var(--border-light) !important;
    color: var(--text-heading) !important;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.92rem;
    outline: none !important;
    box-shadow: none !important;
    transition: border-color 0.15s;
    width: 100%;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--border-focus) !important;
    background-color: #ffffff !important;
    color: var(--text-heading) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 13px 24px;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.15s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-block { width: 100%; }

/* Footer */
.user-footer {
    margin-top: auto;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-light);
    padding: 24px 0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-meta a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

@media (max-width: 768px) {
    .register-grid {
        grid-template-columns: 1fr;
    }
    .hero-title {
        font-size: 1.85rem;
    }
    .lookup-form {
        flex-direction: column;
    }
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Table Leader Portal & Join Request Styles
   ========================================================================== */

.join-page-main {
    padding: 40px 16px 80px;
    display: flex;
    justify-content: center;
}

.join-form-card {
    max-width: 620px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.join-table-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-top: 8px;
}

.join-table-name {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 700;
}

.friendly-notice-box {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 24px;
    font-size: 0.85rem;
    color: #1e40af;
    line-height: 1.45;
}

/* Standalone QR Display Page */
.qr-page-main {
    padding: 36px 16px 80px;
    display: flex;
    justify-content: center;
}

.qr-show-card {
    max-width: 480px;
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    text-align: center;
    box-sizing: border-box;
}

.qr-table-header {
    padding: 28px 24px 20px;
    border-bottom: 1px solid var(--border-light);
    background-color: #f8fafc;
}

.qr-table-pill {
    display: inline-block;
    padding: 4px 14px;
    background-color: var(--primary);
    color: white;
    font-weight: 800;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.qr-table-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-heading);
    margin-bottom: 6px;
}

.qr-table-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.qr-canvas-wrapper {
    padding: 32px 24px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#standaloneQrBox {
    padding: 16px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    margin-bottom: 16px;
}

#standaloneQrBox canvas,
#standaloneQrBox img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

.qr-code-caption {
    margin-top: 4px;
}

.qr-instruction-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.qr-share-section {
    padding: 20px 24px;
    background-color: #f8fafc;
    border-top: 1px solid var(--border-light);
    text-align: left;
}

.qr-share-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 8px;
}

.copy-input-group {
    display: flex;
    gap: 8px;
}

.copy-input-group input {
    flex: 1;
    font-size: 0.82rem;
}

.qr-card-actions {
    padding: 16px 24px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-light);
}

/* Global Toast Notification */
.copy-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: #0f172a;
    color: #f8fafc;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.88rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    opacity: 0;
    transition: all 0.25s ease-in-out;
}

.copy-toast i {
    color: #34d399;
    font-size: 1.05rem;
}

.copy-toast.toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.portal-header-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-top: 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.04);
}

.table-lead-badge {
    display: inline-block;
    padding: 4px 12px;
    background-color: #fef3c7;
    color: #92400e;
    font-size: 0.78rem;
    font-weight: 800;
    border-radius: 20px;
    margin-bottom: 8px;
}

.table-portal-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-heading);
    margin-bottom: 4px;
}

.portal-capacity-box {
    min-width: 240px;
    background-color: var(--bg-elevated);
    padding: 16px 20px;
    border-radius: var(--radius-md);
}

.capacity-numbers {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.capacity-numbers strong {
    color: var(--text-heading);
}

.portal-grid {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.portal-sidebar-col,
.portal-main-col {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.portal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 24px;
}

.portal-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.portal-card-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-heading);
}

.portal-card-body {
    padding: 28px 24px;
}

#attendanceQrCanvas {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    margin: 8px auto 16px auto;
    max-width: 100%;
    box-sizing: border-box;
}

#attendanceQrCanvas canvas,
#attendanceQrCanvas img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
}

.share-url-box {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.border-warning {
    border-color: #fed7aa !important;
}

.bg-warning-light {
    background-color: #fffbeb;
}

.badge-full {
    background-color: #fee2e2;
    color: #b91c1c;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.leader-mini-badge {
    display: inline-block;
    padding: 2px 6px;
    background-color: #fef3c7;
    color: #92400e;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    margin-left: 6px;
}

.code-badge {
    display: inline-block;
    padding: 4px 10px;
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap !important;
}

.badge-tag {
    display: inline-block;
    padding: 4px 10px;
    background-color: #f1f5f9;
    border-radius: 4px;
    font-size: 0.78rem;
    color: var(--text-body);
    white-space: nowrap !important;
}

.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 700;
}

.status-confirmed { background-color: #dbeafe; color: #1e40af; }
.status-checked_in { background-color: #d1fae5; color: #065f46; }
.status-pending { background-color: #fef3c7; color: #92400e; }
.status-cancelled { background-color: #fee2e2; color: #991b1b; }

.btn-xs { padding: 4px 8px; font-size: 0.72rem; }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; }
.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-body);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.btn-outline:hover {
    background-color: var(--bg-elevated);
}

.btn-ghost {
    background-color: transparent;
    border: none;
    cursor: pointer;
}

.btn-success {
    background-color: #059669;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
}

.btn-danger {
    background-color: #dc2626;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-box {
    background-color: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    box-sizing: border-box;
}

.modal-box.modal-lg {
    max-width: 860px !important;
    width: 95vw !important;
}

.modal-box.modal-xl {
    max-width: 1050px !important;
    width: 96vw !important;
}

.modal-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    gap: 16px;
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.modal-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-heading);
    margin: 0 0 2px 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background-color 0.15s;
}

.modal-close:hover {
    color: var(--text-heading);
    background-color: var(--bg-elevated);
}

.modal-body {
    padding: 24px 28px;
}

.modal-footer {
    padding: 18px 28px;
    background-color: #f8fafc;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.p-0 { padding: 0 !important; }
.mb-4 { margin-bottom: 24px; }
.mt-4 { margin-top: 24px; }
.gap-2 { gap: 8px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-xs { font-size: 0.75rem; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    background-color: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tr:hover td {
    background-color: #f8fafc;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Comprehensive Mobile Responsive Breakpoints
   ========================================================================== */

@media (max-width: 900px) {
    .portal-header-card {
        flex-direction: column;
        align-items: stretch;
        padding: 20px 18px !important;
        gap: 16px;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .portal-capacity-box {
        width: 100% !important;
        min-width: unset !important;
        box-sizing: border-box !important;
    }

    .portal-grid {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 20px;
        box-sizing: border-box !important;
    }

    .portal-sidebar-col,
    .portal-main-col {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .portal-card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .table-responsive {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        display: block !important;
        box-sizing: border-box !important;
    }

    .data-table {
        min-width: 540px;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .nav-container {
        flex-direction: column;
        gap: 10px;
        align-items: center;
        text-align: center;
        padding: 12px 16px !important;
        height: auto !important;
        min-height: unset !important;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        width: 100%;
    }

    .nav-links .badge-tag {
        font-size: 0.72rem;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .portal-header-card {
        padding: 18px 14px !important;
        margin-top: 14px;
        margin-bottom: 16px;
        border-radius: var(--radius-md) !important;
    }

    .table-portal-title {
        font-size: 1.35rem !important;
        line-height: 1.3;
    }

    .portal-card-header {
        padding: 14px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .portal-card-header h3 {
        font-size: 0.95rem;
    }

    .portal-card-body {
        padding: 16px;
    }

    .share-url-box {
        flex-direction: column;
        gap: 8px;
    }

    .share-url-box input {
        width: 100% !important;
        font-size: 0.8rem;
    }

    .share-url-box button {
        width: 100% !important;
        padding: 10px;
        justify-content: center;
    }

    .join-page-main {
        padding: 20px 12px 60px !important;
    }

    .join-form-card,
    .register-form-card {
        padding: 20px 14px !important;
        margin: 0 auto !important;
        width: 100% !important;
        border-radius: var(--radius-md) !important;
    }

    .join-table-title {
        font-size: 1.4rem !important;
    }

    .friendly-notice-box {
        padding: 12px 14px !important;
        font-size: 0.8rem !important;
    }

    .modal-box {
        max-width: 95% !important;
        margin: 10px !important;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 14px !important;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-footer button {
        width: 100% !important;
        justify-content: center;
    }

    .data-table td, 
    .data-table th {
        padding: 10px 12px;
        font-size: 0.78rem;
    }

    .btn-xs {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}

@media (max-width: 420px) {
    .table-portal-title {
        font-size: 1.2rem !important;
    }

    .table-lead-badge {
        font-size: 0.7rem;
    }

    .user-container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
}

/* ==========================================================================
   Portable Attendance Scanner & Passcode Overlay Styles
   ========================================================================== */

.portable-scanner-main {
    padding-top: 24px;
    padding-bottom: 60px;
}

.scanner-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 12px 18px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--success);
}

.status-dot {
    width: 10px;
    height: 10px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.15); }
}

.stats-badge {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-light);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-body);
}

.stats-badge strong {
    color: var(--primary);
}

.scanner-idle-box {
    padding: 48px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
}

.scanner-icon-large {
    font-size: 3.5rem;
    color: var(--primary);
    opacity: 0.5;
}

.table-pill {
    padding: 6px 14px;
    background-color: var(--primary);
    color: white;
    font-weight: 800;
    font-size: 1rem;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.counter-badge {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 800;
    white-space: nowrap;
}

.table-leader-strip {
    background-color: #f8fafc;
    padding: 14px 28px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.leader-details {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-heading);
}

.attendee-check-table th,
.attendee-check-table td {
    padding: 14px 20px !important;
    vertical-align: middle;
}

.attendee-check-table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.row-checked {
    background-color: #f0fdf4 !important;
}

.row-checked strong {
    color: #15803d;
}

.attendee-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--success);
}

.quick-chips-wrapper {
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.chip-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.table-chip-btn {
    padding: 6px 12px;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-light);
    color: var(--text-heading);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.15s;
}

.table-chip-btn:hover {
    background-color: #eff6ff;
    border-color: var(--primary);
    color: var(--primary);
}

/* Passcode Lock Modal Overlay */
.passcode-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.passcode-modal-card {
    background-color: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    padding: 32px 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    text-align: center;
    box-sizing: border-box;
}

.lock-icon-circle {
    width: 60px;
    height: 60px;
    background-color: #eff6ff;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 16px auto;
}

.font-bold {
    font-weight: 700;
    letter-spacing: 0.2em;
}

@media (max-width: 640px) {
    .scanner-status-bar {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}

/* ==========================================================================
   Projector / Standalone Lucky Draw Stage CSS
   ========================================================================== */
.stage-body {
    background: radial-gradient(circle at 50% 20%, #1e1b4b 0%, #0f172a 45%, #020617 100%);
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    user-select: none;
    --bs-body-color: #ffffff !important;
    --bs-secondary-color: #ffffff !important;
}

.stage-body .text-muted,
.stage-body .text-secondary,
.stage-body [class*="text-muted"],
.stage-body small {
    color: #ffffff !important;
    --bs-secondary-color: #ffffff !important;
}

.confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

/* Stage Header */
.stage-header {
    height: 72px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 100;
}

.stage-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stage-logo {
    height: 38px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.stage-brand-spark {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #f59e0b, #ec4899);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.stage-brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
}

.stage-title-divider {
    width: 1px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.15);
}

.stage-draw-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #cbd5e1;
    margin: 0;
}

/* Stage Navigation */
.stage-header-center {
    display: flex;
    align-items: center;
}

.stage-nav-controls {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 30px;
    padding: 4px 6px;
    gap: 8px;
}

.stage-nav-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stage-nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: scale(1.1);
}

.stage-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.stage-prize-indicator {
    font-size: 0.85rem;
    padding: 0 12px;
    color: #e2e8f0;
}

.stage-prize-indicator strong {
    color: #fbbf24;
}

/* Stage Header Right */
.stage-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stage-pool-badge {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pool-dot {
    width: 8px;
    height: 8px;
    background-color: #34d399;
    border-radius: 50%;
    box-shadow: 0 0 8px #34d399;
}

.stage-action-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.stage-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Main Viewport & Slides */
.stage-viewport {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 32px;
    position: relative;
    box-sizing: border-box;
}

.stage-slides-wrapper {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

.stage-slide {
    display: none;
    opacity: 0;
    transition: opacity 0.35s ease-in-out;
}

.stage-slide.active {
    display: block;
    opacity: 1;
}

.stage-empty-card {
    text-align: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 60px 40px;
}

.stage-empty-card i {
    font-size: 4rem;
    color: #64748b;
    margin-bottom: 16px;
}

/* ==========================================================================
   Group Prizes Stage Styles (Card Grid)
   ========================================================================== */
.group-prize-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.group-stage-header {
    text-align: center;
    margin-bottom: 28px;
}

.stage-tier-pill {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #c7d2fe;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 6px 18px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.group-prize-name {
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffffff;
    margin: 0 0 6px 0;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.group-prize-quota {
    font-size: 0.95rem;
    color: #94a3b8;
}

.group-prize-quota strong {
    color: #fbbf24;
}

.group-winners-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    width: 100%;
    max-height: 52vh;
    overflow-y: auto;
    padding: 8px 4px;
    box-sizing: border-box;
}

.group-winner-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 16px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-rank {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 800;
    color: #94a3b8;
    flex-shrink: 0;
}

.card-winner-content {
    flex-grow: 1;
    min-width: 0;
}

.card-winner-name {
    font-size: 1rem;
    font-weight: 800;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-winner-ident {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 600;
    margin-top: 2px;
}

.card-winner-detail {
    font-size: 0.72rem;
    color: #38bdf8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Card States during roll */
.group-winner-card.card-rolling {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.15);
    animation: cardPulse 0.4s infinite alternate;
}

.group-winner-card.card-revealed {
    border-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(236, 72, 153, 0.12));
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
}

.group-winner-card.card-revealed .card-rank {
    background: #f59e0b;
    color: #0f172a;
}

.group-winner-card.card-revealed .card-winner-name {
    color: #ffffff;
}

.group-winner-card.card-revealed .card-winner-ident {
    color: #fbbf24;
}

@keyframes cardPulse {
    0% { transform: scale(0.98); opacity: 0.7; }
    100% { transform: scale(1.02); opacity: 1; }
}

/* ==========================================================================
   Single Prize Stage Styles (Spotlight 1-by-1)
   ========================================================================== */
.single-prize-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    text-align: center;
}

.single-stage-header {
    margin-bottom: 28px;
}

.single-tier-glow {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.single-prize-title {
    font-size: 2.8rem;
    font-weight: 900;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.02em;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.single-spotlight-box {
    width: 100%;
    max-width: 780px;
    background: radial-gradient(circle at 50% 50%, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 28px;
    padding: 50px 30px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.single-winner-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.winner-trophy-spark {
    width: 76px;
    height: 76px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(236, 72, 153, 0.2));
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fbbf24;
    margin-bottom: 8px;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.3);
}

.single-winner-name {
    font-size: 3.2rem;
    font-weight: 900;
    color: #ffffff;
    line-height: 1.15;
    letter-spacing: -0.01em;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.single-winner-sub {
    font-size: 1.25rem;
    font-weight: 700;
    color: #94a3b8;
    margin-top: 4px;
}

/* Single Winner States */
.single-winner-display.rolling .single-winner-name {
    color: #818cf8;
    animation: textFlash 0.15s infinite;
}

.single-winner-display.revealed {
    animation: revealZoom 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.single-winner-display.revealed .single-winner-name {
    color: #fbbf24;
    text-shadow: 0 0 30px rgba(251, 191, 36, 0.6);
}

.single-winner-display.revealed .single-winner-sub {
    color: #38bdf8;
}

.single-spotlight-box:has(.revealed) {
    border-color: #f59e0b;
    box-shadow: 0 0 50px rgba(245, 158, 11, 0.3);
}

@keyframes textFlash {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

@keyframes revealZoom {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Roll Action Buttons
   ========================================================================== */
.stage-action-center {
    display: flex;
    justify-content: center;
    width: 100%;
}

.btn-stage-roll {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    color: white;
    border: none;
    border-radius: 40px;
    padding: 18px 48px;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    transition: all 0.25s ease;
    text-transform: uppercase;
}

.btn-stage-roll:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.6);
}

.btn-stage-roll:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-stage-roll:disabled {
    background: rgba(255, 255, 255, 0.12);
    color: #64748b;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-single-glow {
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 50%, #ec4899 100%);
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.45);
    padding: 20px 56px;
    font-size: 1.3rem;
}

.btn-single-glow:hover:not(:disabled) {
    box-shadow: 0 15px 45px rgba(245, 158, 11, 0.7);
}

/* Stage Footer */
.stage-footer {
    height: 48px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    font-size: 0.8rem;
    color: #64748b;
    z-index: 100;
}

.badge-stage-secure {
    color: #34d399;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

@media (max-width: 900px) {
    .stage-header {
        padding: 0 16px;
    }
    .stage-draw-title, .stage-title-divider {
        display: none;
    }
    .single-winner-name {
        font-size: 2.2rem;
    }
    .single-prize-title {
        font-size: 2rem;
    }
    .group-prize-name {
        font-size: 1.6rem;
    }
    .stage-footer-left {
        display: none;
    }
}


