/* =============================================================
   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;
    }
}

/* ─── 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);
    }
}
