/**
 * LatePoint OneQR QR Code Styles
 * 
 * Styles for QR code visibility toggle and display
 * APAK 26.03.2026
 * 
 * @package LatePoint
 * @since 1.2.0
 */

/* QR Code Container */
.oneqr-qr-code-container {
    position: relative;
    text-align: center;
    margin: 10px 0;
    background: #ffffff;  /* Белый фон для десктопа */
    padding: 20px;
    border-radius: 8px;
}

/* QR Code - Visible by default (APAK 26.03.2026) */
.oneqr-qr-code-container .oneqr-qr-code-wrapper {
    display: block;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    background: #ffffff;  /* Белый фон */
}

/* QR Code - Hidden when toggled */
.oneqr-qr-code-container .oneqr-qr-code-wrapper.oneqr-qr-hidden {
    display: none;
    opacity: 0;
}

/* QR Code Image */
.oneqr-qr-code-container .oneqr-qr-code-wrapper img,
.oneqr-qr-code-container .oneqr-qr-code-local canvas {
    max-width: 100%;
    height: auto;
    border: none !important;  /* Убрана рамка для лучшего сканирования */
    border-radius: 0;  /* Убраны закругления */
    padding: 20px;  /* Increased padding for better contrast */
    background: #ffffff !important;
    box-shadow: none !important;  /* Убрана тень */
    display: block;
    margin: 0 auto;
}

/* Local QR Code (QRCode.js) */
.oneqr-qr-code-container .oneqr-qr-code-local {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: #ffffff !important;
    border-radius: 0;
    width: 100%;
    max-width: 400px;  /* Максимальный размер для десктопа */
    min-height: 400px;
    border: none !important;  /* Убрана рамка */
    box-shadow: none !important;  /* Убрана тень */
    margin: 0 auto;  /* Центрирование */
}

.oneqr-qr-code-container .oneqr-qr-code-local canvas {
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    width: 100% !important;  /* Адаптивный размер */
    height: auto !important;  /* Сохранять пропорции */
    max-width: 400px !important;  /* Максимум 400px для десктопа */
    max-height: 400px !important;  /* Максимум 400px для десктопа */
    background: #ffffff !important;
}

/* Toggle Button */
.oneqr-qr-code-container .oneqr-qr-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    margin: 10px 0;
}

.oneqr-qr-code-container .oneqr-qr-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.oneqr-qr-code-container .oneqr-qr-toggle-btn:active {
    transform: translateY(0);
}

.oneqr-qr-code-container .oneqr-qr-toggle-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Toggle Button Icon */
.oneqr-qr-code-container .oneqr-qr-toggle-btn .oneqr-qr-toggle-icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.oneqr-qr-code-container .oneqr-qr-toggle-btn .oneqr-qr-toggle-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Loading State */
.oneqr-qr-code-container .oneqr-qr-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: #666;
    font-size: 14px;
}

.oneqr-qr-code-container .oneqr-qr-loading .latepoint-icon-spin {
    font-size: 24px;
    margin-bottom: 10px;
    color: #667eea;
}

/* Hidden state - utility class */
.oneqr-qr-code-container.oneqr-qr-hidden .oneqr-qr-code-wrapper {
    display: none !important;
}

/* Scan instruction label */
.oneqr-qr-code-container .oneqr-qr-scan-label {
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 15px;
    padding: 10px;
    background: #fff8e1;
    border-radius: 4px;
    border-left: 3px solid #ffc107;
}

/* Offline error message */
.oneqr-qr-code-container .oneqr-qr-error {
    text-align: center;
    padding: 30px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #ffc107;
}

.oneqr-qr-code-container .oneqr-qr-error .latepoint-icon-cloud-off {
    font-size: 48px;
    color: #ffc107;
    display: block;
    margin-bottom: 15px;
}

.oneqr-qr-code-container .oneqr-qr-error strong {
    display: block;
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
}

.oneqr-qr-code-container .oneqr-qr-error span {
    display: block;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* Refresh hint */
.oneqr-qr-code-container .oneqr-qr-refresh-hint {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin-top: 8px;
    padding: 5px;
    background: #f8f9fa;
    border-radius: 4px;
    display: inline-block;
}

.oneqr-qr-code-container .oneqr-qr-refresh-hint i {
    margin-right: 5px;
    animation: oneqr-rotate 2s linear infinite;
}

@keyframes oneqr-rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .oneqr-qr-code-container {
        padding: 10px;
    }

    .oneqr-qr-code-container .oneqr-qr-toggle-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .oneqr-qr-code-container .oneqr-qr-scan-label {
        font-size: 13px;
        margin-bottom: 10px;
        padding: 8px;
    }

    .oneqr-qr-code-container .oneqr-qr-code-local {
        padding: 10px;
        max-width: 100%;
        min-height: auto;
    }

    .oneqr-qr-code-container .oneqr-qr-code-local canvas {
        max-width: 100% !important;
        max-height: 100% !important;
        width: auto !important;
        height: auto !important;
    }

    .oneqr-qr-code-container .oneqr-qr-code-wrapper img {
        max-width: 100%;
        height: auto;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .oneqr-qr-code-container .oneqr-qr-code-wrapper img {
        border-color: #444;
        background: #1a1a1a;
    }
    
    .oneqr-qr-code-container .oneqr-qr-refresh-hint {
        background: #2a2a2a;
        color: #aaa;
    }
}

/* Print styles - always show QR code when printing */
@media print {
    .oneqr-qr-code-container .oneqr-qr-code-wrapper {
        display: block !important;
        opacity: 1 !important;
    }
    
    .oneqr-qr-code-container .oneqr-qr-toggle-btn {
        display: none !important;
    }
}

/* Accessibility - reduced motion */
@media (prefers-reduced-motion: reduce) {
    .oneqr-qr-code-container .oneqr-qr-code-wrapper,
    .oneqr-qr-code-container .oneqr-qr-toggle-btn,
    .oneqr-qr-code-container .oneqr-qr-toggle-btn .oneqr-qr-toggle-icon {
        transition: none;
    }
    
    .oneqr-qr-code-container .oneqr-qr-refresh-hint i {
        animation: none;
    }
}
