/**
 * QR Upload Modal CSS
 * Modal for displaying QR codes for mobile photo uploads
 *
 * @author Claude Code
 * @date 2025-10-23
 */

/* ==========================================
   CSS Custom Properties (Defaults)
   ========================================== */

:root {
    --qr-btn-color1: #667eea;
    --qr-btn-color2: #764ba2;
    --qr-btn-text: #ffffff;
    --qr-header-color1: #667eea;
    --qr-header-color2: #764ba2;
    --qr-header-text: #ffffff;
    --qr-bg: #ffffff;
    --qr-text: #333333;
}

/* ==========================================
   Modal Overlay
   ========================================== */

.qr-modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.qr-modal-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

/* ==========================================
   Modal Container
   ========================================== */

.qr-modal {
    background: var(--qr-bg);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    padding: 0;
}

.qr-modal-overlay.active .qr-modal {
    transform: scale(1);
}

/* ==========================================
   Modal Header
   ========================================== */

.qr-modal-header {
    background: linear-gradient(135deg, var(--qr-header-color1) 0%, var(--qr-header-color2) 100%);
    color: var(--qr-header-text);
    padding: 20px 24px;
    border-radius: 8px 8px 0 0;
    position: relative;
}

.qr-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.qr-modal-subtitle {
    margin: 5px 0 0 0;
    font-size: 14px;
    opacity: 0.9;
}

.qr-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--qr-header-text);
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.qr-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.qr-modal-close:focus {
    outline: 2px solid var(--qr-header-text);
    outline-offset: 2px;
}

/* ==========================================
   Modal Body
   ========================================== */

.qr-modal-body {
    padding: 24px;
    color: var(--qr-text);
}

/* QR Code Container */
.qr-code-container {
    text-align: center;
    margin-bottom: 24px;
}

.qr-code-wrapper {
    display: inline-block;
    padding: 20px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.qr-code-image {
    display: block;
    width: 300px;
    height: 300px;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

.qr-code-loading {
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 4px;
}

.qr-code-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: var(--qr-header-color1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Instructions */
.qr-instructions {
    background: #f8f9fa;
    border-left: 4px solid var(--qr-header-color1);
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.qr-instructions h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: var(--qr-text);
}

.qr-instructions ol {
    margin: 0;
    padding-left: 20px;
    color: #666;
}

.qr-instructions li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.qr-instructions li:last-child {
    margin-bottom: 0;
}

/* Status Information */
.qr-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    background: #e8f4fd;
    border: 1px solid #90caf9;
    border-radius: 4px;
    margin-bottom: 16px;
}

.qr-status-icon {
    font-size: 24px;
}

.qr-status-text {
    font-size: 14px;
    color: #1976d2;
    margin: 0;
}

.qr-status.success {
    background: #e8f5e9;
    border-color: #81c784;
}

.qr-status.success .qr-status-text {
    color: #388e3c;
}

.qr-status.error {
    background: #ffebee;
    border-color: #e57373;
}

.qr-status.error .qr-status-text {
    color: #d32f2f;
}

/* Upload Progress */
.qr-upload-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0;
    margin: 16px 0;
    background: #fafafa;
}

.qr-upload-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    background: #ffffff;
}

.qr-upload-item:last-child {
    border-bottom: none;
}

.qr-upload-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.qr-upload-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.qr-upload-info {
    flex: 1;
    min-width: 0;
}

.qr-upload-filename {
    font-weight: 500;
    color: var(--qr-text);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qr-upload-size {
    font-size: 12px;
    color: #666;
    margin: 0;
}

.qr-upload-status {
    flex-shrink: 0;
    font-size: 20px;
}

/* Timer Display */
.qr-timer {
    text-align: center;
    padding: 12px;
    background: #fff3e0;
    border: 1px solid #ffb74d;
    border-radius: 4px;
    margin-top: 16px;
}

.qr-timer-text {
    font-size: 14px;
    color: #f57c00;
    margin: 0;
}

.qr-timer-countdown {
    font-size: 18px;
    font-weight: 600;
    color: #e65100;
}

/* ==========================================
   Modal Footer
   ========================================== */

.qr-modal-footer {
    padding: 16px 24px;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.qr-modal-button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qr-modal-button-primary {
    background: var(--qr-header-color1);
    color: #ffffff;
}

.qr-modal-button-primary:hover {
    background: var(--qr-header-color2);
}

.qr-modal-button-secondary {
    background: #e0e0e0;
    color: #333;
}

.qr-modal-button-secondary:hover {
    background: #d0d0d0;
}

.qr-modal-button:focus {
    outline: 2px solid var(--qr-header-color1);
    outline-offset: 2px;
}

.qr-modal-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================
   QR Upload Button (in gb_post.php)
   ========================================== */

.qr-upload-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--qr-btn-color1) 0%, var(--qr-btn-color2) 100%);
    color: var(--qr-btn-text);
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin: 10px 0;
}

.qr-upload-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.qr-upload-trigger:active {
    transform: translateY(0);
}

.qr-upload-trigger:focus {
    outline: 2px solid var(--qr-btn-color1);
    outline-offset: 2px;
}

.qr-upload-trigger-icon {
    font-size: 20px;
}

/* ==========================================
   Mobile Responsiveness
   ========================================== */

@media (max-width: 768px) {
    .qr-modal {
        max-width: 95%;
        width: 95%;
    }

    .qr-modal-header {
        padding: 16px 20px;
    }

    .qr-modal-title {
        font-size: 18px;
    }

    .qr-modal-subtitle {
        font-size: 13px;
    }

    .qr-modal-body {
        padding: 16px;
    }

    .qr-code-image,
    .qr-code-loading {
        width: 250px;
        height: 250px;
    }

    .qr-modal-footer {
        flex-direction: column;
    }

    .qr-modal-button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .qr-code-image,
    .qr-code-loading {
        width: 200px;
        height: 200px;
    }

    .qr-instructions {
        padding: 12px 16px;
    }

    .qr-instructions ol {
        font-size: 14px;
    }
}

/* ==========================================
   Accessibility
   ========================================== */

/* Prevent body scroll when modal is open */
body.qr-modal-open {
    overflow: hidden;
}

/* Screen reader only text */
.qr-sr-only {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .qr-modal {
        border: 2px solid #000000;
    }

    .qr-modal-close {
        border: 2px solid #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .qr-modal-overlay,
    .qr-modal,
    .qr-modal-button,
    .qr-upload-trigger {
        transition: none;
    }

    .qr-code-spinner {
        animation: none;
        border-top-color: transparent;
    }
}

/* Print styles */
@media print {
    .qr-modal-overlay {
        display: none !important;
    }
}
