/* ==========================================
   Fitwhey Sure Lab Test Page Styles
   Version: 1.0
   Updated: October 2025
   ========================================== */

/* ==========================================
   Scan Barcode Button Section
   ========================================== */
.scan-barcode-section {
    text-align: center;
    margin-top: 20px;
    padding: 15px 0;
}

.scan-barcode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #dc0000 0%, #b30000 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(220, 0, 0, 0.3);
}

.scan-barcode-btn:hover {
    background: linear-gradient(135deg, #b30000 0%, #8b0000 100%);
    box-shadow: 0 6px 16px rgba(220, 0, 0, 0.4);
    transform: translateY(-2px);
}

.scan-barcode-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(220, 0, 0, 0.3);
}

.scan-barcode-btn svg {
    width: 20px;
    height: 20px;
}

/* ==========================================
   Search Input Styles
   ========================================== */
.search-controls-container {
    margin: 20px 0;
    background: linear-gradient(135deg, rgba(220, 0, 0, 0.05) 0%, rgba(220, 0, 0, 0.02) 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(220, 0, 0, 0.08);
}

.main-search-wrapper {
    margin-bottom: 15px;
}

.search-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input-container {
    position: relative;
    flex: 1;
    display: flex;
}

.lab-search {
    flex: 1;
    width: 100%;
    padding: 14px 45px 14px 18px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.lab-search:focus {
    outline: none;
    border-color: #dc0000;
    box-shadow: 0 4px 16px rgba(220, 0, 0, 0.2);
    transform: translateY(-2px);
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 45% !important;
    transform: translateY(-48%);
    background: none;
    border: none;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.2s ease;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
}

.search-clear-btn:hover {
    color: #dc0000;
    transform: translateY(-48%) scale(1.15);
}

.search-clear-btn:active {
    transform: translateY(-48%) scale(0.95);
}

.search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #dc0000 0%, #b30000 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(220, 0, 0, 0.2);
}

.search-btn:hover {
    background: linear-gradient(135deg, #b30000 0%, #8b0000 100%);
    box-shadow: 0 4px 12px rgba(220, 0, 0, 0.3);
    transform: translateY(-2px);
}

.search-btn:active {
    transform: translateY(0);
}

.search-btn svg {
    width: 18px;
    height: 18px;
    stroke: white;
}

/* ==========================================
   Search Divider and Scan Barcode Inline
   ========================================== */
.scan-barcode-section-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.scan-barcode-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scan-barcode-btn-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #dc0000 0%, #b30000 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(220, 0, 0, 0.2);
    white-space: nowrap;
}

.scan-barcode-btn-inline:hover {
    background: linear-gradient(135deg, #b30000 0%, #8b0000 100%);
    box-shadow: 0 4px 12px rgba(220, 0, 0, 0.3);
    transform: translateY(-2px);
}

.scan-barcode-btn-inline:active {
    transform: translateY(0);
}

.scan-barcode-btn-inline svg {
    width: 18px;
    height: 18px;
}

/* ==========================================
   Search Input Styles
   ========================================== */

/* ==========================================
   Pagination Styles
   ========================================== */
.total-items {
    display: block;
    font-size: 0.85em;
    opacity: 0.8;
    margin-top: 2px;
}

a.pagination-btn.disabled,
.pagination-wrapper a.pagination-btn.disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    background-color: #e9ecef !important;
    border-color: #ced4da !important;
    color: #6c757d !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

a.pagination-btn.disabled:hover,
.pagination-wrapper a.pagination-btn.disabled:hover {
    background-color: #e9ecef !important;
    border-color: #ced4da !important;
    color: #6c757d !important;
    text-decoration: none !important;
    transform: none !important;
}

a.pagination-btn.disabled svg,
.pagination-wrapper a.pagination-btn.disabled svg {
    fill: #6c757d !important;
    color: #6c757d !important;
}

/* ==========================================
   Fancybox v6 Overrides
   ========================================== */
.fancybox__container {
    z-index: 9999 !important;
}

.fancybox__backdrop {
    background: rgba(0, 0, 0, 0.87) !important;
}

.fancybox__content {
    background: transparent !important;
}

/* ==========================================
   Barcode Scanner Modal
   ========================================== */
.barcode-scanner-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.barcode-scanner-overlay {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.barcode-scanner-container {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.barcode-scanner-header {
    background: #dc0000;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.barcode-scanner-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.barcode-scanner-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.barcode-scanner-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.barcode-scanner-content {
    padding: 20px;
    text-align: center;
    position: relative;
}

/* ==========================================
   QR Reader Styles
   ========================================== */
#qr-reader {
    position: relative;
    z-index: 1;
    max-width: 100%;
    overflow: hidden;
}

#qr-reader video {
    object-fit: cover !important;
    width: 100% !important;
    height: auto !important;
    transform: scaleX(1);
    border-radius: 8px;
    -webkit-backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    transform: translateZ(0);
}

#qr-reader__scan_region {
    position: relative;
    border: 2px solid #dc0000 !important;
    border-radius: 8px;
}

#qr-reader__dashboard_section_csr {
    display: none !important;
}

#qr-reader__scan_region::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    border: 2px dashed rgba(220, 0, 0, 0.5);
    border-radius: 4px;
    pointer-events: none;
}

#qr-reader canvas {
    border-radius: 8px;
}

.barcode-scanner-status {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.barcode-scanner-status p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.barcode-scanner-status small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #999;
}

.barcode-scanner-help {
    margin-top: 15px;
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
}

.barcode-scanner-help details {
    cursor: pointer;
}

.barcode-scanner-help summary {
    font-weight: 600;
    color: #856404;
    padding: 5px;
    user-select: none;
}

.barcode-scanner-help summary:hover {
    color: #533f03;
}

.barcode-scanner-help ol {
    margin: 10px 0 10px 20px;
    padding: 0;
    color: #856404;
}

.barcode-scanner-help li {
    margin: 8px 0;
    line-height: 1.5;
}

.barcode-scanner-help p {
    margin: 10px 0 0 0;
    color: #856404;
}

.barcode-scanner-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

.barcode-scanner-cancel {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.barcode-scanner-cancel:hover {
    background: #5a6268;
}

/* ==========================================
   Video Container (16:9 Responsive)
   ========================================== */
.lab-video-container {
    max-width: 800px;
    margin: 0 auto 30px;
    padding: 0 20px;
}

.lab-video {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.lab-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ==========================================
   Product Info Styles
   ========================================== */
.product-info {
    line-height: 1.6;
}

.product-brand {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.product-name {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.product-flavour {
    font-size: 13px;
    font-style: italic;
    color: #888;
}

/* Mobile Card Product Styles */
.card-product-brand {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.card-product-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.card-product-flavour {
    font-size: 14px;
    font-style: italic;
    color: #888;
}

/* ==========================================
   Intro Toggle Button
   ========================================== */
.intro-toggle-section {
    text-align: center;
    margin: 20px 0;
}

.intro-toggle-btn {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    color: #333;
    border: 1px solid #ddd;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.intro-toggle-btn:hover {
    background: linear-gradient(135deg, #e8e8e8 0%, #d9d9d9 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.intro-toggle-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.intro-expandable-content {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   Mobile Responsive Styles
   ========================================== */
@media (max-width: 768px) {
    /* Barcode Scanner */
    .barcode-scanner-container {
        max-width: 95%;
        margin: 10px;
    }

    .barcode-scanner-overlay {
        padding: 10px;
    }

    #qr-reader {
        max-height: 400px;
    }

    #qr-reader video {
        max-height: 400px;
    }

    /* Video Container */
    .lab-video-container {
        max-width: 100%;
        padding: 0;
        margin-bottom: 20px;
    }

    .lab-video {
        border-radius: 0;
    }

    /* Intro Toggle Button */
    .intro-toggle-btn {
        padding: 10px 25px;
        font-size: 14px;
    }

    .search-controls-container {
        padding: 15px 12px;
    }

    .search-input-wrapper {
        flex-wrap: nowrap;
        gap: 6px;
    }

    .search-input-container {
        flex: 1;
        display: flex;
        min-width: 0;
    }

    .lab-search {
        flex: 1;
        width: 100%;
        min-width: 0;
        margin-bottom: 0;
        padding: 12px 40px 12px 14px;
        font-size: 15px;
        height: 48px;
        box-sizing: border-box;
    }

    .search-btn {
        flex: 0 0 auto;
        width: 48px;
        height: 48px;
        padding: 0;
        flex-shrink: 0;
    }

    .search-clear-btn {
        position: absolute;
        right: 8px;
        top: 48%;
        transform: translateY(-48%);
        font-size: 18px;
        padding: 4px;
        display: none;
        z-index: 10;
    }

    .search-clear-btn:hover {
        transform: translateY(-48%) scale(1.15);
    }

    .search-clear-btn:active {
        transform: translateY(-48%) scale(0.95);
    }

    .scan-barcode-section-inline {
        margin-top: 12px;
        padding-top: 12px;
        flex-direction: column;
        gap: 10px;
    }

    .scan-barcode-label {
        display: none;
    }

    .scan-barcode-btn-inline {
        width: 100%;
    }
}

/* ==========================================
   iOS Specific Fixes
   ========================================== */
@supports (-webkit-touch-callout: none) {
    #qr-reader video {
        object-fit: cover !important;
    }
}
