/* Core Stylesheet & Print System for SCS Asset Management System */

/* Custom CSS Variables & Design System */
:root {
    --primary: #dc2626; /* Tailwind Red 600 */
    --primary-hover: #b91c1c; /* Tailwind Red 700 */
    --bg-main: #f8fafc; /* Slate 50 */
    --text-main: #0f172a; /* Slate 900 */
    --text-muted: #64748b; /* Slate 500 */
    --border-color: #e2e8f0; /* Slate 200 */
    --card-bg: rgba(255, 255, 255, 0.85);
    --glass-blur: blur(12px);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.03);
}

/* Base resets & transitions */
body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-premium);
}

.glass-input {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
    outline: none;
}

/* Micro-animations */
.hover-lift {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}
.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -8px rgba(0, 0, 0, 0.12);
}

.tab-active {
    border-bottom: 2px solid var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* Signature Pad Canvas Styling */
.signature-container {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    background-color: #f8fafc;
    overflow: hidden;
    touch-action: none; /* Prevents scrolling when signing */
}

.signature-canvas {
    display: block;
    width: 100%;
    height: 180px;
    cursor: crosshair;
}

/* Custom QR Scanner Styling */
.scanner-viewport-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 4px solid #334155;
    background: #0f172a;
    box-shadow: var(--shadow-premium);
}

#reader__scan_region {
    background: #0f172a !important;
}

#reader {
    border: none !important;
}

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

/* Scan laser animation overlay */
.scanner-laser {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, transparent, #ef4444, transparent);
    animation: scanning 2s linear infinite;
    pointer-events: none;
    z-index: 10;
}

@keyframes scanning {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}

/* ----------------------------------------- */
/* STICKER / TAG STYLING                     */
/* ----------------------------------------- */

/* A6 Inspection Tag Dimensions (1 per page) */
.a6-preview {
    width: 105mm;
    height: 148mm;
    background: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    margin: 0 auto 20px auto;
    position: relative;
    overflow: hidden;
    border: 1px solid #d1d5db;
    box-sizing: border-box;
}

.tag-header {
    background-color: var(--primary); 
    color: white;
    text-align: center;
    padding: 8px 0;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tag-body {
    padding: 4mm 5mm;
    display: flex;
    flex-direction: column;
    height: calc(148mm - 46px);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
    margin-bottom: 8px;
}

.info-label { 
    font-weight: 600; 
    color: #4b5563; 
    font-size: 0.75rem; 
    text-transform: uppercase; 
}

.info-value { 
    font-weight: 700; 
    color: #111827; 
    border-bottom: 1px solid #e5e7eb; 
    padding-bottom: 2px; 
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.serial-box {
    background-color: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    text-align: center;
    padding: 6px;
    margin-bottom: 8px;
}

.serial-number {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    font-weight: 900;
    color: #0f172a;
}

.inspection-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.65rem;
    flex-grow: 1;
}

.inspection-table th, .inspection-table td { 
    border: 1px solid #cbd5e1; 
    padding: 3px 2px; 
    text-align: center; 
}

.inspection-table th { 
    background-color: #f1f5f9; 
    font-weight: 700; 
    color: #334155; 
}

.tag-footer { 
    text-align: center; 
    font-size: 0.65rem; 
    color: #64748b; 
    margin-top: auto; 
    padding-top: 4px; 
    border-top: 1px dashed #cbd5e1; 
}

/* Small Stickers layout (8 per A6 sheet) */
.a6-sheet {
    width: 105mm;
    height: 148mm;
    background: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    margin: 0 auto 20px auto;
    padding: 4mm;
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 Columns */
    grid-template-rows: repeat(4, 1fr); /* 4 Rows */
    gap: 4mm;
    box-sizing: border-box;
}

.small-sticker {
    border: 1px dashed #94a3b8; /* Cut guides */
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2mm;
    box-sizing: border-box;
    background-color: #ffffff;
    position: relative;
    overflow: hidden;
}

.small-sticker-header {
    font-size: 0.55rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    width: 100%;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 2px;
    padding-bottom: 2px;
    letter-spacing: 0.05em;
}

.qr-container {
    margin: 2px 0;
    padding: 2px;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
}

.small-serial {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    font-weight: 900;
    color: #0f172a;
}

.small-details {
    font-size: 0.5rem;
    color: #475569;
    text-transform: uppercase;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ----------------------------------------- */
/* PRINT MEDIA SYSTEM                        */
/* ----------------------------------------- */
@media print {
    body {
        background-color: white !important;
        margin: 0 !important;
        padding: 0 !important;
        color: black !important;
    }
    
    .no-print {
        display: none !important;
    }
    
    /* Center container and remove background styling in print mode */
    #printArea {
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        display: block !important;
    }
    
    /* Force exactly A6 pages */
    .a6-preview, .a6-sheet {
        box-shadow: none !important;
        margin: 0 !important;
        border: none !important;
        page-break-after: always !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .small-sticker {
        border: 1px dashed #94a3b8 !important; /* Keep guides in print to make cutting easy */
    }
    

}
