/**
 * QR Scanner Modal Styles
 * Extracted from qr_scanner_modal.html for maintainability
 */

/* Scanner Container */
.qr-scanner-container {
    position: relative;
    background: #000;
    min-height: 400px;
    max-height: 60vh;
    overflow: hidden;
}

#qr-reader {
    width: 100%;
    height: 100%;
    position: relative;
}

#qr-reader video {
    width: 100% !important;
    height: auto !important;
    object-fit: cover;
}

/* Scanner Overlay */
.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scan-frame {
    width: 250px;
    height: 250px;
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Corner decorations */
.scan-frame::before,
.scan-frame::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid var(--success-color, #198754);
}

.scan-frame::before {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 8px;
}

.scan-frame::after {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 8px;
}

/* Scanning Line Animation */
.scan-line {
    position: absolute;
    width: 250px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--success-color, #198754), transparent);
    animation: scan 2s linear infinite;
    box-shadow: 0 0 10px var(--success-color, #198754);
}

@keyframes scan {
    0%, 100% {
        transform: translateY(-125px);
    }
    50% {
        transform: translateY(125px);
    }
}

/* Scanner Controls */
.scanner-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 10;
}

.btn-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
}

.btn-circle:hover {
    transform: scale(1.1);
}

.btn-circle.active {
    background-color: var(--warning-color, #ffc107);
    border-color: var(--warning-color, #ffc107);
}

/* Status and Result */
.scanner-status,
.scan-result {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 10;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.scan-result {
    top: auto;
    bottom: 80px;
}

/* Instructions */
.scanner-instructions {
    border-top: 1px solid #dee2e6;
}

.scanner-instructions ul {
    padding-left: 20px;
}

.scanner-instructions li {
    margin-bottom: 5px;
    color: #6c757d;
}

/* Manual Input Fallback */
.manual-qr-input {
    padding: 1rem;
    background-color: var(--table-header-bg, #f8f9fa);
    border-top: 1px solid var(--card-border, #dee2e6);
}

.manual-qr-input .input-group {
    max-width: 400px;
    margin: 0 auto;
}

.manual-qr-input .form-label {
    font-weight: 500;
    color: var(--body-color, #212529);
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .qr-scanner-container {
        min-height: 300px;
    }

    .scan-frame {
        width: 200px;
        height: 200px;
    }

    .scan-line {
        width: 200px;
    }

    .scanner-controls {
        bottom: 10px;
    }

    .btn-circle {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
}

/* Fullscreen mode for mobile */
@media (max-width: 576px) {
    #qr-scanner-modal .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100vh;
    }

    #qr-scanner-modal .modal-content {
        height: 100%;
        border-radius: 0;
    }

    .qr-scanner-container {
        min-height: 50vh;
        max-height: 50vh;
    }
}

/* =============================================
   Stock Adjustment Modal Styles
   ============================================= */

/* Mobile-first approach */
#stock-adjustment-modal .modal-dialog {
    max-width: 500px;
    margin: 0.5rem auto;
}

/* Fullscreen on mobile */
@media (max-width: 576px) {
    #stock-adjustment-modal .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }

    #stock-adjustment-modal .modal-content {
        min-height: 100vh;
        border-radius: 0;
    }

    #stock-adjustment-modal .modal-body {
        padding: 0.75rem;
    }
}

/* Large touch-friendly buttons */
#stock-adjustment-modal .stock-adjust-btn {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-width: 2px;
}

/* Active state for touch feedback */
#stock-adjustment-modal .stock-adjust-btn:active {
    transform: scale(0.95);
}

/* Stock value display */
#modal-stock-value {
    transition: all 0.3s ease;
}

#modal-stock-value.updated {
    animation: stockPulse 0.5s ease;
}

@keyframes stockPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); color: #198754; }
}

/* Movement type toggle - larger touch targets */
#stock-adjustment-modal .btn-group label.btn {
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

/* Quantity input styling */
#stock-adjust-quantity {
    font-size: 1.5rem;
    font-weight: bold;
    border: 2px solid #dee2e6;
}

#stock-adjust-quantity:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Confirm button styling */
#btn-confirm-stock {
    padding: 1rem;
    font-size: 1.1rem;
}

/* Loading state */
#stock-adjustment-modal .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Success animation */
.stock-success-animation {
    animation: successFade 2s ease forwards;
}

@keyframes successFade {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* Product info card compact */
#stock-adjustment-modal .card-body dl {
    line-height: 1.4;
}

#stock-adjustment-modal .card-body dt {
    font-weight: 500;
}

/* Stock display card */
#stock-adjustment-modal .display-4 {
    font-size: 3rem;
}

@media (max-width: 576px) {
    #stock-adjustment-modal .display-4 {
        font-size: 2.5rem;
    }

    #stock-adjustment-modal .stock-adjust-btn {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }
}
