/* ========================================================================= */
/* FLORA STEELS / XEN BATH FITTINGS — DESIGN SYSTEM & 3D ELEVATIONS         */
/* ========================================================================= */

:root {
    --primary-blue: #0284c7;
    --primary-indigo: #4f46e5;
    --navy-900: #0f172a;
    --navy-800: #1e293b;
    --navy-700: #334155;
    --slate-500: #64748b;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --emerald-500: #10b981;
    --amber-500: #f59e0b;
    --rose-500: #f43f5e;
    --card-shadow: 0 20px 50px -10px rgba(15, 23, 42, 0.07), 0 10px 25px -5px rgba(2, 132, 199, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
    background-color: #f8fafc;
    background-image: 
        radial-gradient(at 0% 0%, rgba(224, 239, 254, 0.75) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(240, 249, 255, 0.65) 0px, transparent 40%),
        radial-gradient(at 50% 100%, rgba(226, 232, 240, 0.8) 0px, transparent 60%),
        radial-gradient(at 100% 100%, rgba(219, 234, 254, 0.5) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--navy-800);
}

.font-display {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", sans-serif;
}

/* 3D Elevated Cards */
.card-3d {
    background: linear-gradient(155deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 1rem;
    box-shadow: 
        0 20px 45px -10px rgba(15, 23, 42, 0.08),
        0 8px 20px -4px rgba(2, 132, 199, 0.06),
        inset 0 1.5px 0 #ffffff;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-3d:hover {
    box-shadow: 
        0 25px 55px -12px rgba(15, 23, 42, 0.12),
        0 12px 28px -6px rgba(2, 132, 199, 0.12),
        inset 0 1.5px 0 #ffffff;
}

/* Multi-line clamp utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* Gradient Action Buttons */
.btn-primary-gradient {
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 50%, #4f46e5 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 
        0 10px 25px -3px rgba(37, 99, 235, 0.38),
        0 4px 10px -2px rgba(14, 165, 233, 0.25),
        inset 0 1.5px 0 rgba(255, 255, 255, 0.4);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 14px 30px -4px rgba(37, 99, 235, 0.48),
        0 6px 14px -2px rgba(14, 165, 233, 0.3),
        inset 0 1.5px 0 rgba(255, 255, 255, 0.5);
}

.btn-primary-gradient:active {
    transform: translateY(1px) scale(0.985);
    box-shadow: 0 3px 8px -1px rgba(37, 99, 235, 0.3);
}

/* 3D Inputs */
.input-3d {
    background: #ffffff;
    border: 1px solid rgba(203, 213, 225, 0.95);
    border-radius: 0.625rem;
    box-shadow: 
        inset 0 2px 4px rgba(15, 23, 42, 0.04),
        0 1px 0 rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
}

.input-3d:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 
        0 0 0 4px rgba(14, 165, 233, 0.16),
        0 4px 12px -2px rgba(2, 132, 199, 0.1);
}

/* Status Badges */
.badge-done {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
    border: 1px solid #86efac;
}

.badge-awaiting {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    color: #5b21b6;
    border: 1px solid #c4b5fd;
}

.badge-planned,
.badge-progress {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0369a1;
    border: 1px solid #7dd3fc;
}

.badge-pending {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #fcd34d;
}

.badge-overdue {
    background: linear-gradient(135deg, #ffe4e6 0%, #fecdd3 100%);
    color: #9f1239;
    border: 1px solid #fda4af;
}

/* Glass table */
.table-container {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 0.875rem;
    box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.04);
}

.table-header-sticky th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 10;
    border-bottom: 2px solid #e2e8f0;
}

/* Pulse animation */
@keyframes pulse-subtle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.02); }
}

.pulse-glow {
    animation: pulse-subtle 3s infinite ease-in-out;
}

/* ========================================================================= */
/* PROGRESSIVE WEB APP (PWA) MOBILE & STANDALONE ENHANCEMENTS                */
/* ========================================================================= */

/* Safe Area Insets for Modern Mobile Notches & Navigation Bars */
@supports (padding: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top, 0px);
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* Standalone PWA Mode Specific Tweaks */
@media all and (display-mode: standalone) {
    body {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    input, textarea, select, [contenteditable="true"] {
        user-select: text;
        -webkit-user-select: text;
    }

    /* Fixed top header spacing in standalone mode */
    header.sticky {
        padding-top: max(0.5rem, env(safe-area-inset-top));
    }
}

/* Smooth Touch Scrolling on iOS */
.overflow-y-auto, .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
}

/* Connection Banner Animations */
#pwaNetworkBanner {
    animation: slideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ========================================================================= */
/* ULTRA-SMOOTH PILL SPINNER LOADER & PAGE TRANSITION SYSTEM                 */
/* ========================================================================= */

@keyframes fsPillFade {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.95); }
    100% { opacity: 0.12; transform: scale(0.9); }
}

@keyframes fsPillSpinSmooth {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.animate-spin-smooth {
    animation: fsPillSpinSmooth 0.85s linear infinite;
    transform-origin: center center;
}

.fs-pill-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.fs-pill-loader svg {
    width: 100%;
    height: 100%;
}

/* Top Progress Bar for Seamless AJAX */
#topProgressBar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #0284c7, #3b82f6, #6366f1, #8b5cf6);
    z-index: 99999;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.7), 0 0 5px rgba(2, 132, 199, 0.5);
    transition: width 0.25s ease, opacity 0.3s ease;
    pointer-events: none;
}

/* Global Full-Screen Glassmorphic Loader Overlay */
#globalPageLoader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99990;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#globalPageLoader.is-active {
    opacity: 1;
    pointer-events: auto;
}

.loader-card-popup {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 1.25rem;
    padding: 1.75rem 2.25rem;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(99, 102, 241, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.875rem;
    transform: scale(0.96);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#globalPageLoader.is-active .loader-card-popup {
    transform: scale(1);
}

/* Shimmer Loading Placeholder */
.skeleton-shimmer {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


