/* =============================================================
   QR Code Widget — Enterprise-Grade Design
   PrayerTimeV1 — Professional, Accessible, Mobile-First
   ============================================================= */

/* ─── Floating Action Button ───────────────────────────── */
.qr-fab {
    position: fixed;
    bottom: 88px;
    right: 20px;
    z-index: 1050;

    display: flex;
    align-items: center;
    gap: 8px;

    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 14px 22px;
    cursor: pointer;
    box-shadow:
        0 8px 24px rgba(102, 126, 234, 0.4),
        0 4px 12px rgba(118, 75, 162, 0.3);

    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;

    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.95;
}

.qr-fab::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50px;
    padding: 2px;
    background: linear-gradient(135deg, #f093fb, #667eea, #764ba2);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s;
}

.qr-fab:hover::before {
    opacity: 1;
}

.qr-fab:hover,
.qr-fab:focus-visible {
    transform: translateY(-4px) scale(1.05);
    box-shadow:
        0 12px 32px rgba(102, 126, 234, 0.5),
        0 6px 16px rgba(118, 75, 162, 0.4);
    opacity: 1;
}

.qr-fab:active {
    transform: translateY(-2px) scale(1.02);
}

.qr-fab-icon {
    font-size: 1.35rem;
    line-height: 1;
    animation: qrPulse 2s ease-in-out infinite;
}

@keyframes qrPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Mobile: icon-only circle */
@media (max-width: 767.98px) {
    .qr-fab {
        bottom: 80px;
        right: 16px;
        border-radius: 50%;
        width: 56px;
        height: 56px;
        padding: 0;
        justify-content: center;
    }
    .qr-fab-label {
        display: none !important;
    }
    .qr-fab-icon {
        font-size: 1.4rem;
    }
}

/* ─── WhatsApp Floating Button ─────────────────────────── */
.wa-fab {
    position: fixed;
    bottom: 152px; /* 88px QR + 48px QR height + 16px gap */
    right: 20px;
    z-index: 1050;

    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;

    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #fff;
    border-radius: 50px;
    padding: 14px 22px;
    box-shadow:
        0 8px 24px rgba(37, 211, 102, 0.4),
        0 4px 12px rgba(18, 140, 126, 0.3);

    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;

    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.95;
}

.wa-fab:hover,
.wa-fab:focus-visible {
    transform: translateY(-4px) scale(1.05);
    box-shadow:
        0 12px 32px rgba(37, 211, 102, 0.5),
        0 6px 16px rgba(18, 140, 126, 0.4);
    opacity: 1;
    color: #fff;
}

.wa-fab:active {
    transform: translateY(-2px) scale(1.02);
}

.wa-fab-icon {
    width: 1.35rem;
    height: 1.35rem;
    flex-shrink: 0;
    animation: qrPulse 2s ease-in-out infinite;
}

/* Mobile: icon-only circle, aligned with QR fab */
@media (max-width: 767.98px) {
    .wa-fab {
        bottom: 148px; /* 80px QR + 56px QR height + 12px gap */
        right: 16px;
        border-radius: 50%;
        width: 56px;
        height: 56px;
        padding: 0;
        justify-content: center;
    }
    .wa-fab-label {
        display: none !important;
    }
    .wa-fab-icon {
        width: 1.4rem;
        height: 1.4rem;
    }
}

/* ─── WhatsApp Contact Modal ────────────────────────────── */
.wa-modal-dialog { max-width: 420px; }

.wa-modal-content {
    background: #0d1117;
    border: 1px solid rgba(37, 211, 102, 0.18);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
    color: #e2e8f0;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Hero header */
.wa-modal-hero {
    position: relative;
    background: linear-gradient(135deg, #075E54 0%, #128C7E 50%, #25D366 100%);
    padding: 1.4rem 1.4rem 1rem;
    overflow: hidden;
}

.wa-hero-glow {
    position: absolute;
    top: -40px; right: -40px;
    width: 160px; height: 160px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.wa-close-btn {
    position: absolute;
    top: 0.85rem; right: 0.9rem;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 2;
}
.wa-close-btn:hover { background: rgba(255,255,255,0.28); }

.wa-hero-inner {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    position: relative;
    z-index: 1;
}

.wa-hero-avatar {
    position: relative;
    width: 56px; height: 56px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.wa-online-dot {
    position: absolute;
    bottom: 2px; right: 2px;
    width: 13px; height: 13px;
    background: #4ade80;
    border-radius: 50%;
    border: 2px solid #128C7E;
    box-shadow: 0 0 6px rgba(74,222,128,0.7);
    animation: waPulse 2s ease-in-out infinite;
}

@keyframes waPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(74,222,128,0.7); }
    50%       { box-shadow: 0 0 12px rgba(74,222,128,1); }
}

.wa-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.01em;
}

.wa-modal-subtitle {
    font-size: 0.76rem;
    color: rgba(255,255,255,0.82);
    margin-top: 2px;
}

.wa-online-icon {
    font-size: 0.5rem;
    color: #4ade80;
    vertical-align: middle;
}

.wa-hero-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.9rem;
    position: relative;
    z-index: 1;
}

.wa-badge {
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 20px;
    padding: 0.22rem 0.65rem;
    border: 1px solid rgba(255,255,255,0.25);
    letter-spacing: 0.02em;
    backdrop-filter: blur(4px);
}

/* Form body */
.wa-modal-body {
    padding: 1.2rem 1.4rem 0.6rem;
}

.wa-intro-text {
    font-size: 0.84rem;
    color: #94a3b8;
    background: rgba(37,211,102,0.06);
    border-left: 3px solid #25D366;
    border-radius: 0 8px 8px 0;
    padding: 0.55rem 0.8rem;
    margin-bottom: 1.1rem;
    font-style: normal;
}

.wa-field-group { margin-bottom: 0; }

.wa-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}

.wa-field-icon { color: #25D366; font-size: 0.85rem; }

.wa-required-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(239,68,68,0.15);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 20px;
    padding: 0.1rem 0.45rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-left: auto;
}

.wa-optional-badge {
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(148,163,184,0.1);
    color: #64748b;
    border: 1px solid rgba(148,163,184,0.2);
    border-radius: 20px;
    padding: 0.1rem 0.45rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-left: auto;
}

.wa-input-wrap { position: relative; }

.wa-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 11px;
    color: #e2e8f0;
    font-size: 0.9rem;
    padding: 0.65rem 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    font-family: inherit;
}

.wa-input::placeholder { color: #475569; }

.wa-input:focus {
    outline: none;
    background: rgba(37,211,102,0.06);
    border-color: rgba(37,211,102,0.45);
    box-shadow: 0 0 0 3px rgba(37,211,102,0.1);
    color: #f1f5f9;
}

.wa-textarea { resize: none; }

.wa-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%2394a3b8' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    cursor: pointer;
}

.wa-select option {
    background: #1e293b;
    color: #e2e8f0;
}

/* Topic chips */
.wa-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.wa-chip {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8;
    border-radius: 20px;
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.wa-chip:hover {
    background: rgba(37,211,102,0.1);
    border-color: rgba(37,211,102,0.35);
    color: #4ade80;
}

.wa-chip-active {
    background: rgba(37,211,102,0.15);
    border-color: #25D366;
    color: #4ade80;
    font-weight: 700;
}

/* Char counter */
.wa-char-row { display: flex; justify-content: flex-end; margin-top: 0.3rem; }

.wa-char-count {
    font-size: 0.72rem;
    color: #475569;
    transition: color 0.2s;
}

.wa-char-warn { color: #f97316 !important; }

/* Validation */
.wa-validation-msg {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 10px;
    color: #fca5a5;
    font-size: 0.82rem;
    padding: 0.6rem 0.85rem;
    margin-top: 0.6rem;
}

/* Footer */
.wa-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 0.75rem 1.4rem 1.2rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.wa-cancel-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    color: #64748b;
    border-radius: 10px;
    padding: 0.52rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.wa-cancel-btn:hover {
    border-color: rgba(255,255,255,0.2);
    color: #94a3b8;
}

.wa-send-btn {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border: none;
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    border-radius: 11px;
    padding: 0.55rem 1.3rem;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 4px 16px rgba(37,211,102,0.3);
    font-family: inherit;
    letter-spacing: 0.01em;
}

.wa-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37,211,102,0.45);
    color: #fff;
}

.wa-send-btn:active { transform: translateY(0); }

/* Mobile tweaks */
@media (max-width: 480px) {
    .wa-modal-dialog { margin: 0.75rem; max-width: 100%; }
    .wa-modal-hero { padding: 1.1rem 1.1rem 0.85rem; }
    .wa-modal-body { padding: 1rem 1.1rem 0.5rem; }
    .wa-modal-footer { padding: 0.65rem 1.1rem 1rem; }
}

/* ─── Modal Dialog ─────────────────────────────────────── */
.qr-modal-dialog {
    max-width: 420px;
}

/* ─── Modal Shell ──────────────────────────────────────── */
.qr-modal-content {
    border: none;
    border-radius: 24px;
    overflow: hidden;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.2),
        0 12px 30px rgba(102, 126, 234, 0.15);
    background: #ffffff;
}

/* ─── Modal Header ─────────────────────────────────────── */
.qr-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: #fff;
    padding: 20px 24px;
    border-bottom: none;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.qr-modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

.qr-modal-header::after {
    content: '';
    position: absolute;
    bottom: -60%;
    left: -20%;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    pointer-events: none;
}

.qr-header-left {
    position: relative;
    z-index: 1;
    flex: 1;
}

.qr-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.qr-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.qr-modal-subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 4px;
    font-weight: 400;
}

.qr-secure-badge {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    white-space: nowrap;
}

/* ─── Modal Body ───────────────────────────────────────── */
.qr-modal-body {
    background: #f8f9fc;
    padding: 32px 28px 24px;
    position: relative;
}

/* QR Image Wrapper with Scan Frame */
.qr-image-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 20px;
    padding: 28px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(102, 126, 234, 0.08);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.qr-image-wrapper:hover {
    transform: scale(1.02);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 4px 16px rgba(102, 126, 234, 0.12);
}

/* Scan frame corners */
.qr-scan-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: #667eea;
    border-style: solid;
    z-index: 2;
    transition: border-color 0.3s ease;
}

.qr-scan-corner.qr-corner-tl {
    top: 12px;
    left: 12px;
    border-width: 3px 0 0 3px;
    border-radius: 6px 0 0 0;
}

.qr-scan-corner.qr-corner-tr {
    top: 12px;
    right: 12px;
    border-width: 3px 3px 0 0;
    border-radius: 0 6px 0 0;
}

.qr-scan-corner.qr-corner-bl {
    bottom: 12px;
    left: 12px;
    border-width: 0 0 3px 3px;
    border-radius: 0 0 0 6px;
}

.qr-scan-corner.qr-corner-br {
    bottom: 12px;
    right: 12px;
    border-width: 0 3px 3px 0;
    border-radius: 0 0 6px 0;
}

/* Scan line animation */
.qr-scan-line {
    position: absolute;
    left: 16px;
    right: 16px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
    z-index: 3;
    opacity: 0;
    top: 16px;
    pointer-events: none;
}

.qr-scan-line.qr-scan-active {
    opacity: 1;
    animation: qrScanMove 1.5s ease-in-out infinite;
}

.qr-scan-line.qr-scan-done {
    opacity: 0;
    transition: opacity 0.5s ease;
}

@keyframes qrScanMove {
    0%   { top: 16px; }
    50%  { top: calc(100% - 18px); }
    100% { top: 16px; }
}

.qr-image {
    display: block;
    border-radius: 12px;
    position: relative;
    z-index: 1;
}

/* ─── Step Instructions ────────────────────────────────── */
.qr-instruction {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    background: #fff;
    border-radius: 14px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    overflow: hidden;
}

.qr-instruction-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: #495057;
    font-weight: 500;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.06);
    transition: background 0.2s ease;
}

.qr-instruction-step:last-child {
    border-bottom: none;
}

.qr-instruction-step:hover {
    background: rgba(102, 126, 234, 0.03);
}

.qr-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ─── Action Buttons ───────────────────────────────────── */
.qr-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.qr-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.qr-action-btn:active {
    transform: scale(0.96);
}

/* Copy button */
.qr-btn-copy {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
}

.qr-btn-copy:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.45);
    transform: translateY(-1px);
}

.qr-btn-copy.qr-copied {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
}

/* Download button */
.qr-btn-download {
    background: #fff;
    color: #495057;
    border: 1.5px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.qr-btn-download:hover {
    border-color: #667eea;
    color: #667eea;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.12);
    transform: translateY(-1px);
}

/* Share button */
.qr-btn-share {
    background: #fff;
    color: #495057;
    border: 1.5px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.qr-btn-share:hover {
    border-color: #764ba2;
    color: #764ba2;
    box-shadow: 0 4px 14px rgba(118, 75, 162, 0.12);
    transform: translateY(-1px);
}

/* ─── Modal Footer ─────────────────────────────────────── */
.qr-modal-footer {
    background: #f1f3f8;
    border-top: 1px solid rgba(102, 126, 234, 0.08);
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.qr-url-display {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    padding: 10px 14px;
    background: #fff;
    border-radius: 10px;
    border: 1.5px solid rgba(102, 126, 234, 0.12);
    cursor: pointer;
    transition: all 0.2s ease;
}

.qr-url-display:hover {
    border-color: #667eea;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.1);
}

.qr-url-display.qr-copied {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.04);
}

.qr-url-icon {
    color: #667eea;
    font-size: 1rem;
    flex-shrink: 0;
}

.qr-url-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 0.75rem;
    color: #495057;
    font-weight: 500;
}

.qr-url-copy-hint {
    color: #adb5bd;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: color 0.2s;
}

.qr-url-display:hover .qr-url-copy-hint {
    color: #667eea;
}

/* Footer badges */
.qr-footer-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.qr-enc-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.qr-hmac-badge {
    background: linear-gradient(135deg, #10b981, #059669);
}

/* Close button */
.btn-close-white {
    filter: brightness(0) invert(1);
    opacity: 0.8;
    transition: all 0.2s;
    background-size: 55%;
}

.btn-close-white:hover {
    opacity: 1;
    transform: rotate(90deg);
}

/* ─── Modal Animation ──────────────────────────────────── */
#qrCodeModal.modal.fade .modal-dialog {
    transform: scale(0.9) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.25s ease;
    opacity: 0;
}

#qrCodeModal.modal.show .modal-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 576px) {
    .qr-modal-dialog {
        margin: 12px;
        max-width: calc(100% - 24px);
    }

    .qr-modal-content {
        border-radius: 20px;
    }

    .qr-modal-header {
        padding: 16px 20px;
    }

    .qr-modal-title {
        font-size: 1.05rem;
    }

    .qr-modal-subtitle {
        font-size: 0.75rem;
    }

    .qr-modal-body {
        padding: 24px 20px 20px;
    }

    .qr-image-wrapper {
        padding: 22px;
    }

    .qr-image {
        width: 180px !important;
        height: 180px !important;
    }

    .qr-instruction-step {
        padding: 10px 16px;
        font-size: 0.78rem;
    }

    .qr-actions {
        gap: 8px;
    }

    .qr-action-btn {
        padding: 9px 14px;
        font-size: 0.78rem;
    }

    .qr-modal-footer {
        padding: 14px 20px;
    }

    .qr-url-text {
        max-width: 180px;
    }

    .qr-footer-badges {
        gap: 6px;
    }

    .qr-enc-badge {
        font-size: 0.62rem;
        padding: 3px 10px;
    }
}

/* ─── Dark Mode ────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    .qr-modal-content {
        background: #1e1e2e;
        box-shadow:
            0 24px 60px rgba(0, 0, 0, 0.5),
            0 12px 30px rgba(0, 0, 0, 0.3);
    }

    .qr-modal-body {
        background: #1e1e2e;
    }

    .qr-image-wrapper {
        background: #2a2a3e;
        box-shadow:
            0 4px 20px rgba(0, 0, 0, 0.2),
            0 2px 8px rgba(102, 126, 234, 0.1);
    }

    .qr-image {
        filter: contrast(1.05) invert(1);
        mix-blend-mode: screen;
    }

    .qr-instruction {
        background: #2a2a3e;
        border-color: rgba(102, 126, 234, 0.15);
    }

    .qr-instruction-step {
        color: #b0b4c0;
        border-bottom-color: rgba(102, 126, 234, 0.08);
    }

    .qr-instruction-step:hover {
        background: rgba(102, 126, 234, 0.06);
    }

    .qr-btn-download,
    .qr-btn-share {
        background: #2a2a3e;
        color: #cdd0d8;
        border-color: #3a3a4e;
    }

    .qr-btn-download:hover {
        background: #333350;
        border-color: #667eea;
        color: #8fa4f0;
    }

    .qr-btn-share:hover {
        background: #333350;
        border-color: #764ba2;
        color: #b088d0;
    }

    .qr-modal-footer {
        background: #181828;
        border-top-color: rgba(102, 126, 234, 0.1);
    }

    .qr-url-display {
        background: #2a2a3e;
        border-color: rgba(102, 126, 234, 0.15);
    }

    .qr-url-display:hover {
        background: #333350;
        border-color: #667eea;
    }

    .qr-url-text {
        color: #b0b4c0;
    }

    .qr-url-copy-hint {
        color: #555570;
    }

    .qr-url-display:hover .qr-url-copy-hint {
        color: #8fa4f0;
    }

    .btn-close-white {
        filter: brightness(0) invert(1);
    }
}

/* =============================================================
   AI Chat FAB & Modal
   ============================================================= */

/* ─── Chat FAB ────────────────────────────────────────────── */
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 20px;
    z-index: 1050;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 20px rgba(245,158,11,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #000;
    transition: box-shadow .2s, transform .2s;
    flex-shrink: 0;
}

.chat-fab:hover,
.chat-fab:focus-visible {
    box-shadow: 0 6px 28px rgba(245,158,11,.75);
    transform: translateY(-2px);
    color: #000;
}

.chat-fab-dot {
    display: none;
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #1a1a2e;
    animation: chatFabPulse 1.5s infinite;
}

@keyframes chatFabPulse {
    0%,100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.25); opacity: .7; }
}

@media (max-width: 767.98px) {
    .chat-fab {
        bottom: 20px;
        right: 16px;
    }
}

/* ─── Chat Modal Dialog ────────────────────────────────────── */
.chat-modal-dialog {
    max-width: 390px;
    margin: auto;
}

@media (max-width: 480px) {
    .chat-modal-dialog {
        max-width: 100%;
        margin: 0.5rem;
        align-self: center;
    }
    #chatModal .modal-dialog {
        margin: 0.5rem auto;
    }
}

.chat-modal-content {
    background: rgba(15, 12, 41, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(245,158,11,.15);
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.8);
}

/* ─── Hero Header ──────────────────────────────────────────── */
.chat-modal-hero {
    position: relative;
    background: linear-gradient(135deg, rgba(245,158,11,.18) 0%, rgba(217,119,6,.1) 100%);
    border-bottom: 1px solid rgba(245,158,11,.12);
    padding: 1rem 1rem 0.75rem;
}

.chat-hero-glow {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(245,158,11,.2) 0%, transparent 70%);
    pointer-events: none;
}

.chat-hero-inner {
    display: flex;
    align-items: center;
    gap: .75rem;
    position: relative;
}

.chat-hero-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.4rem;
    color: #fff;
    box-shadow: 0 4px 12px rgba(245,158,11,.4);
}

.chat-online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid rgba(15,12,41,.95);
    animation: chatOnlinePulse 2s infinite;
}

@keyframes chatOnlinePulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
    50%      { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

.chat-hero-text { flex: 1; }

.chat-modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: #fbbf24;
    line-height: 1.2;
    margin: 0;
}

.chat-modal-subtitle {
    font-size: .75rem;
    color: rgba(255,255,255,.5);
    margin: 2px 0 0;
}

.chat-online-icon {
    font-size: .5rem;
    color: #22c55e;
    vertical-align: middle;
}

.chat-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .65rem;
    position: relative;
}

.chat-badge {
    display: inline-flex;
    align-items: center;
    font-size: .68rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    background: rgba(245,158,11,.15);
    border: 1px solid rgba(245,158,11,.3);
    color: #fbbf24;
    letter-spacing: .02em;
}

.chat-badge-warn {
    background: rgba(239,68,68,.15);
    border-color: rgba(239,68,68,.3);
    color: #fca5a5;
}

.chat-badge-green {
    background: rgba(34,197,94,.12);
    border-color: rgba(34,197,94,.3);
    color: #86efac;
}

.chat-close-btn {
    position: absolute;
    top: .75rem;
    right: .75rem;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 50%;
    color: rgba(255,255,255,.6);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .8rem;
    transition: all .2s;
    z-index: 2;
}

.chat-close-btn:hover {
    background: rgba(255,255,255,.18);
    color: #fff;
}

/* ─── Messages Area ────────────────────────────────────────── */
.chat-modal-messages {
    height: 320px;
    overflow-y: auto;
    padding: .75rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}

@media (max-width: 480px) {
    .chat-modal-messages { height: 260px; }
}

.chat-bubble {
    max-width: 85%;
    padding: .5rem .75rem;
    font-size: .85rem;
    line-height: 1.5;
    word-break: break-word;
}

.chat-bubble.user {
    align-self: flex-end;
    background: #f59e0b;
    color: #000;
    border-radius: 1rem 1rem 0 1rem;
    white-space: pre-wrap;
}

.chat-bubble.bot {
    align-self: flex-start;
    background: rgba(255,255,255,.1);
    color: #fff;
    border-radius: 1rem 1rem 1rem 0;
    white-space: normal;
}

.chat-bubble.bot strong { color: #fbbf24; font-weight: 700; }
.chat-bubble.bot em { color: #93c5fd; font-style: italic; }
.chat-bubble.bot code {
    background: rgba(0,0,0,.35);
    border-radius: 4px;
    padding: .1em .4em;
    font-size: .82em;
    color: #86efac;
    font-family: 'Cascadia Code','Fira Code',monospace;
}
.chat-bubble.bot ul, .chat-bubble.bot ol { margin: .4rem 0 .2rem 1.1rem; padding: 0; }
.chat-bubble.bot li { margin-bottom: .2rem; }
.chat-bubble.bot h3, .chat-bubble.bot h4 { font-size: .92rem; font-weight: 700; color: #fbbf24; margin: .5rem 0 .25rem; }
.chat-bubble.bot hr { border: none; border-top: 1px solid rgba(255,255,255,.15); margin: .5rem 0; }
.chat-bubble.bot p { margin: 0 0 .4rem; }
.chat-bubble.bot p:last-child { margin-bottom: 0; }

.chat-bubble.error {
    align-self: flex-start;
    background: rgba(239,68,68,.18);
    color: #fca5a5;
    border-radius: 1rem 1rem 1rem 0;
}

/* ─── Typing Indicator ─────────────────────────────────────── */
.chat-typing-indicator {
    display: none;
    align-self: flex-start;
    padding: .4rem .75rem;
    gap: 4px;
    background: rgba(255,255,255,.1);
    border-radius: 1rem 1rem 1rem 0;
    margin: 0 .75rem .25rem;
    width: fit-content;
}

.chat-typing-indicator span {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,.6);
    animation: chatBounce 1.2s infinite;
}
.chat-typing-indicator span:nth-child(2) { animation-delay: .2s; }
.chat-typing-indicator span:nth-child(3) { animation-delay: .4s; }

@keyframes chatBounce {
    0%,80%,100% { transform: translateY(0); }
    40%          { transform: translateY(-6px); }
}

/* ─── Input Row ────────────────────────────────────────────── */
.chat-modal-input-row {
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    padding: .6rem .75rem .75rem;
    border-top: 1px solid rgba(255,255,255,.08);
    background: rgba(0,0,0,.2);
}

.chat-input-field {
    flex: 1;
    resize: none;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: .6rem;
    color: #fff;
    font-size: .85rem;
    padding: .45rem .6rem;
    outline: none;
    max-height: 90px;
    overflow-y: auto;
    line-height: 1.4;
    font-family: inherit;
}

.chat-input-field::placeholder { color: rgba(255,255,255,.35); }
.chat-input-field:focus { border-color: rgba(245,158,11,.5); }

.chat-send-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    border-radius: .6rem;
    color: #000;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 1rem;
    transition: opacity .15s;
}

.chat-send-btn:disabled { opacity: .4; cursor: not-allowed; }
