/* Fluid Typography & Responsive Base */
:root {
    --pavara-blue: #0084ff;
    --pavara-white: #ffffff;
    --fluid-min-width: 320;
    --fluid-max-width: 1440;
    --fluid-min-size: 14;
    --fluid-max-size: 16;
}

html {
    font-size: clamp(
        calc(var(--fluid-min-size) * 1px),
        calc(var(--fluid-min-size) * 1px + (var(--fluid-max-size) - var(--fluid-min-size)) * (100vw - var(--fluid-min-width) * 1px) / (var(--fluid-max-width) - var(--fluid-min-width))),
        calc(var(--fluid-max-size) * 1px)
    );
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body { 
    font-family: 'Inter', 'Noto Sans Thai', sans-serif; 
    background-color: #525659; 
    overflow-x: hidden;
}

/* Performance Optimizations */
.quotation-card, 
.sidebar-transition, 
.login-glass, 
.custom-swal-popup,
.signature-modal-glass {
    backface-visibility: hidden;
    perspective: 1000px;
    transform: translateZ(0); /* Hardware acceleration */
    will-change: transform, opacity;
}

.custom-scrollbar {
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.no-scrollbar::-webkit-scrollbar { display: none; }

:root { --pavara-blue: #0084ff; --pavara-white: #ffffff; }
.pavara-wrapper { display: flex; align-items: center; font-family: 'Roboto', sans-serif; font-weight: 900; background-color: transparent; padding: 5px; width: fit-content; transform: scale(0.35); transform-origin: center; }
.pavara-circle { width: 150px; height: 150px; flex-shrink: 0; background-color: var(--pavara-blue); border: 6px solid var(--pavara-white); border-radius: 50%; display: flex; justify-content: center; align-items: center; color: var(--pavara-white); font-weight: 700; font-size: 125px; padding-bottom: 10px; line-height: 1; margin-right: -8px; position: relative; z-index: 2; box-shadow: 0 0 0 1px rgba(0,0,0,0.05); padding-left: 12px; }
.pavara-content { display: flex; flex-direction: column; justify-content: center; width: max-content; padding-left: 15px; }
.stroked-text { color: var(--pavara-blue); -webkit-text-stroke: 4px var(--pavara-white); paint-order: stroke fill; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1)); }
.pavara-title { display: block; font-weight: 700; font-size: 82px; line-height: 0.8; letter-spacing: -2px; margin-bottom: 4px; transform: scaleY(1.05); transform-origin: bottom left; -webkit-text-stroke-width: 2px; }
.pavara-line { height: 6px; background-color: var(--pavara-blue); width: 100%; border: 2px solid var(--pavara-white); border-radius: 2px; margin-bottom: 4px; }
.pavara-subtitle { display: flex; justify-content: space-between; width: 100%; font-weight: 700; font-size: 27px; line-height: 1; white-space: nowrap; letter-spacing: 0.5px; -webkit-text-stroke-width: 1.5px; }

.a4-page {
    width: 210mm; min-height: 297mm; background: white; padding: 10mm; position: relative;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex; flex-direction: column; margin-bottom: 2rem; 
}

.pdf-table {
    border-collapse: collapse !important;
    width: 100%;
}
.pdf-table th, 
.pdf-table td {
    border: 1px solid #9ca3af !important; 
}

.pdf-product-title {
    display: block; font-weight: 700; font-size: 11px; color: #000; line-height: 1.3;
}
.pdf-desc-text {
    white-space: pre-wrap; word-break: break-word; line-height: 1.5; color: #333; font-size: 10px; display: block; margin-bottom: 5px;
}
.pdf-supp-container {
    margin-top: 4px; font-size: 10px;
}

.print-content-fix {
    font-family: 'Noto Sans Thai', sans-serif !important;
    line-height: 1.6 !important; 
    text-rendering: auto !important; 
    -webkit-font-smoothing: antialiased;
    letter-spacing: 0px !important;
    font-variant-ligatures: none !important;
}
.print-content-fix td {
    padding-top: 6px; padding-bottom: 6px;
}
.print-content-fix * {
    letter-spacing: 0px !important;
}

/* SIGMA: Compact Mode CSS adjustment */
.compact-mode-active .pdf-table td {
    padding-top: 2px !important; 
    padding-bottom: 2px !important;
}
.compact-mode-active .pdf-desc-text {
    margin-bottom: 2px !important;
    line-height: 1.3 !important;
}

@media print {
    .a4-page { scale: 0.9; margin: 10px auto; }
}

/* Signature Pad & Profile Modal Styles */
.signature-pad-container {
    width: 100%;
    height: 300px;
    background: #fff;
    border: 2px dashed #e2e8f0;
    border-radius: 1rem;
    position: relative;
    overflow: hidden;
}

.signature-pad-canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

.dark .signature-pad-container {
    background: #1e293b;
    border-color: #334155;
}

.signature-preview-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    background: #f8fafc;
}

.dark .signature-preview-circle {
    border-color: #1e293b;
    background: #0f172a;
}

.mix-blend-multiply {
    mix-blend-mode: multiply;
}

.signature-modal-glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.dark .signature-modal-glass {
    background: rgba(15, 23, 42, 0.8);
}

@keyframes signature-saved {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.signature-animate-success {
    animation: signature-saved 0.5s ease-out;
}

@media print {
    @page { size: A4 portrait; margin: 0; }
    body, html { background-color: white !important; margin: 0; padding: 0; overflow: visible !important; }
    .no-print { display: none !important; }
    #root { display: block !important; background-color: white !important; height: auto !important; overflow: visible !important;}
    #root > div { background-color: white !important; height: auto !important; display: block !important; overflow: visible !important; }
    
    .a4-page { 
        width: 210mm !important; 
        height: 297mm !important; 
        min-height: 297mm !important;
        margin: 0 !important; 
        padding: 10mm !important; 
        box-shadow: none !important; 
        border: none !important; 
        page-break-after: always !important; 
        display: block !important; 
        overflow: hidden !important; 
        transform: none !important; 
    }
    .a4-page:last-child { page-break-after: auto !important; }
    
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    .bg-brand-dark { background-color: #004080 !important; }
    ::-webkit-scrollbar { display: none; }
}

/* Premium Login Styles */
.login-glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.dark .login-glass {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
}

.premium-gradient {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #3b82f6 100%);
}

.animate-blob {
    animation: blob 7s infinite;
}

@keyframes blob {
    0% { transform: translate(0px, 0px) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
    100% { transform: translate(0px, 0px) scale(1); }
}

.animation-delay-2000 {
    animation-delay: 2s;
}

.animation-delay-4000 {
    animation-delay: 4s;
}

/* Sidebar & Grid Refinements */
.sidebar-transition {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapsed {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.quotation-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
}

.quotation-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(37, 99, 235, 0.15);
}

.quotation-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* Custom Scrollbar for Dashboard */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #475569;
}

/* Ensure high contrast in Dark Mode */
.dark .text-gray-600 { color: #94a3b8 !important; }
.dark .text-gray-700 { color: #cbd5e1 !important; }
.dark .text-gray-800 { color: #e2e8f0 !important; }
.dark .text-gray-900 { color: #f8fafc !important; }
.dark .bg-gray-50 { background-color: rgba(30, 41, 59, 0.5) !important; }
.dark .bg-white { background-color: #0f172a !important; }
.dark .border-gray-200 { border-color: #334155 !important; }

/* Premium SweetAlert2 Customization */
.custom-swal-popup {
    border-radius: 32px !important;
    padding: 2.5rem !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15) !important;
}

.dark .custom-swal-popup {
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

.custom-swal-title {
    font-family: 'Inter', 'Noto Sans Thai', sans-serif !important;
    font-weight: 900 !important;
    letter-spacing: -0.02em !important;
    color: #1e293b !important;
    font-size: 1.75rem !important;
    padding-top: 1rem !important;
}

.dark .custom-swal-title {
    color: #f8fafc !important;
}

.custom-swal-content {
    font-family: 'Inter', 'Noto Sans Thai', sans-serif !important;
    color: #64748b !important;
    font-size: 1rem !important;
    line-height: 1.6 !important;
}

.dark .custom-swal-content {
    color: #94a3b8 !important;
}

.custom-swal-confirm-button {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%) !important;
    color: #ffffff !important;
    border-radius: 18px !important;
    padding: 14px 40px !important;
    font-weight: 800 !important;
    font-family: 'Inter', 'Noto Sans Thai', sans-serif !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    font-size: 0.9rem !important;
    border: none !important;
    box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.4) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin: 0.5rem !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

.custom-swal-confirm-button:hover {
    transform: translateY(-3px) scale(1.02) !important;
    box-shadow: 0 20px 25px -5px rgba(37, 99, 235, 0.5) !important;
    filter: brightness(1.1) !important;
}

.custom-swal-cancel-button {
    background: #f8fafc !important;
    color: #1e293b !important;
    border-radius: 18px !important;
    padding: 14px 40px !important;
    font-weight: 700 !important;
    font-family: 'Inter', 'Noto Sans Thai', sans-serif !important;
    border: 1px solid #e2e8f0 !important;
    transition: all 0.3s ease !important;
    margin: 0.5rem !important;
}

.dark .custom-swal-cancel-button {
    background: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
}


.custom-swal-cancel-button:hover {
    background: #e2e8f0 !important;
    color: #1e293b !important;
}

.dark .custom-swal-cancel-button:hover {
    background: #334155 !important;
    color: #f8fafc !important;
}

.swal2-icon {
    border-width: 3px !important;
    scale: 1.1;
    margin-top: 1rem !important;
    margin-bottom: 1.5rem !important;
}

.swal2-actions {
    gap: 0.5rem !important;
    margin-top: 2rem !important;
}

