/* Ultra-Clean Minimalist Design System for Carpet Expo Manager */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --bg-main: #f8fafc;
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6, .font-heading {
    font-family: var(--font-heading);
    letter-spacing: -0.025em;
}

.font-mono {
    font-family: var(--font-mono);
}

/* Minimalist Scrollbars */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Minimalist Flat Surface Cards */
.min-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.min-card:hover {
    border-color: #cbd5e1;
}

/* Minimalist Form Controls */
input, select, textarea {
    transition: all 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #0f172a !important;
    box-shadow: 0 0 0 1px #0f172a !important;
}

/* Minimalist Navigation & Tabs */
.tab-btn {
    transition: all 0.15s ease;
    border-bottom: 2px solid transparent;
}
.tab-btn.active {
    border-bottom-color: #0f172a;
    color: #0f172a;
    font-weight: 700;
}
.tab-btn:not(.active) {
    color: #64748b;
}
.tab-btn:not(.active):hover {
    color: #0f172a;
    border-bottom-color: #cbd5e1;
}

/* Minimal Pill Badges */
.badge-minimal {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
}

/* Print Stylesheet for Full-Length Professional Reports */
@media screen {
    .print-only {
        display: none !important;
    }
}

@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }
    *, *:before, *:after {
        background: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    body {
        background: #ffffff !important;
        color: #0f172a !important;
        font-size: 10pt !important;
        line-height: 1.3 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .no-print, nav, aside, #mainSidebar, #sidebarBackdrop, #navbar, .btn-action, .toast-container, .modal, form.filter-form, .filter-box {
        display: none !important;
    }
    .print-only {
        display: block !important;
        margin-bottom: 1rem;
    }
    .min-card {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
    }
    .overflow-x-auto, .overflow-y-auto {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }
    table {
        width: 100% !important;
        max-width: 100% !important;
        border-collapse: collapse !important;
        page-break-inside: auto !important;
        font-size: 9.5pt !important;
    }
    thead {
        display: table-header-group !important;
    }
    tr {
        page-break-inside: avoid !important;
        page-break-after: auto !important;
    }
    th {
        background-color: #f1f5f9 !important;
        color: #0f172a !important;
        border: 1px solid #cbd5e1 !important;
        font-weight: 700 !important;
        padding: 6px 8px !important;
    }
    td {
        border: 1px solid #e2e8f0 !important;
        padding: 6px 8px !important;
        color: #0f172a !important;
    }
    .badge-minimal, span[class*="rounded-full"] {
        border: 1px solid #94a3b8 !important;
        padding: 2px 6px !important;
        color: #0f172a !important;
        background: transparent !important;
    }
}

/* ==========================================================================
   Expandable & Collapsible Responsive Sidebar System (Default: Shrunk)
   ========================================================================== */

#mainSidebar {
    transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s ease;
}

@media (min-width: 1024px) {
    /* 1. Base / Default State on Desktop: Shrunk (68px) */
    #mainSidebar {
        width: 68px;
    }

    /* 2. Expanded State (256px / 16rem) */
    html.sidebar-expanded #mainSidebar,
    body.sidebar-expanded #mainSidebar {
        width: 256px;
    }

    /* 3. Explicit Shrunk State (68px) */
    html.sidebar-shrunk #mainSidebar,
    body.sidebar-shrunk #mainSidebar {
        width: 68px;
    }

    /* --- SHRUNK MODE SPECIFIC STYLES --- */
    html.sidebar-shrunk #mainSidebar .sidebar-text,
    body.sidebar-shrunk #mainSidebar .sidebar-text,
    html.sidebar-shrunk #mainSidebar .sidebar-badge-text,
    body.sidebar-shrunk #mainSidebar .sidebar-badge-text,
    html.sidebar-shrunk #mainSidebar .sidebar-user-info,
    body.sidebar-shrunk #mainSidebar .sidebar-user-info,
    html.sidebar-shrunk #mainSidebar .sidebar-section-header,
    body.sidebar-shrunk #mainSidebar .sidebar-section-header,
    html.sidebar-shrunk #mainSidebar .sidebar-collapse-btn,
    body.sidebar-shrunk #mainSidebar .sidebar-collapse-btn {
        display: none !important;
    }

    /* Brand Header in Shrunk Mode: Perfectly Centered Logo */
    html.sidebar-shrunk #mainSidebar .sidebar-header,
    body.sidebar-shrunk #mainSidebar .sidebar-header {
        justify-content: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    html.sidebar-shrunk #mainSidebar .sidebar-brand-link,
    body.sidebar-shrunk #mainSidebar .sidebar-brand-link {
        justify-content: center !important;
        margin: 0 auto !important;
    }

    /* Nav Items in Shrunk Mode: Centered 42x42px icon squares */
    html.sidebar-shrunk #mainSidebar .sidebar-nav-item,
    body.sidebar-shrunk #mainSidebar .sidebar-nav-item {
        width: 42px !important;
        height: 42px !important;
        padding: 0 !important;
        margin: 0 auto 4px auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 0.75rem !important;
        position: relative;
    }

    html.sidebar-shrunk #mainSidebar .sidebar-nav-item .sidebar-icon,
    body.sidebar-shrunk #mainSidebar .sidebar-nav-item .sidebar-icon {
        margin: 0 !important;
        width: auto !important;
        text-align: center !important;
        font-size: 1rem !important;
    }

    /* Subtle divider lines in shrunk state */
    html.sidebar-shrunk #mainSidebar .sidebar-section-divider,
    body.sidebar-shrunk #mainSidebar .sidebar-section-divider {
        display: block !important;
        width: 28px !important;
        height: 1px !important;
        background-color: #e2e8f0 !important;
        margin: 8px auto !important;
    }

    /* Pulse dot only for active alert */
    html.sidebar-shrunk #mainSidebar .sidebar-alert-dot,
    body.sidebar-shrunk #mainSidebar .sidebar-alert-dot {
        display: block !important;
    }

    /* Footer Toggle in Shrunk Mode: Centered 42x42px square */
    html.sidebar-shrunk #mainSidebar .sidebar-footer-toggle,
    body.sidebar-shrunk #mainSidebar .sidebar-footer-toggle {
        width: 42px !important;
        height: 42px !important;
        padding: 0 !important;
        margin: 0 auto !important;
        justify-content: center !important;
        border-radius: 0.75rem !important;
    }

    /* User Profile in Shrunk Mode: Centered stack */
    html.sidebar-shrunk #mainSidebar .sidebar-user-footer,
    body.sidebar-shrunk #mainSidebar .sidebar-user-footer {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 6px 0 !important;
        gap: 6px !important;
        background: transparent !important;
        border: none !important;
    }

    html.sidebar-shrunk #mainSidebar .sidebar-logout-btn,
    body.sidebar-shrunk #mainSidebar .sidebar-logout-btn {
        width: 32px !important;
        height: 32px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 auto !important;
    }

    /* Floating Tooltip in Shrunk Mode */
    html.sidebar-shrunk #mainSidebar [data-tooltip] {
        position: relative;
    }
    html.sidebar-shrunk #mainSidebar [data-tooltip]:hover::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 14px);
        top: 50%;
        transform: translateY(-50%);
        background: #0f172a;
        color: #f8fafc;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: -0.01em;
        padding: 5px 10px;
        border-radius: 8px;
        white-space: nowrap;
        pointer-events: none;
        z-index: 1000;
        box-shadow: 0 4px 14px -1px rgba(15, 23, 42, 0.28);
        opacity: 0;
        animation: sidebarTooltipIn 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
    html.sidebar-shrunk #mainSidebar [data-tooltip]:hover::before {
        content: '';
        position: absolute;
        left: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        border: 4px solid transparent;
        border-right-color: #0f172a;
        pointer-events: none;
        z-index: 1000;
        opacity: 0;
        animation: sidebarTooltipIn 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    @keyframes sidebarTooltipIn {
        from {
            opacity: 0;
            transform: translateY(-50%) translateX(-4px);
        }
        to {
            opacity: 1;
            transform: translateY(-50%) translateX(0);
        }
    }
}

@media (max-width: 1023px) {
    #mainSidebar {
        width: 256px !important;
    }
    .sidebar-alert-dot,
    .sidebar-section-divider {
        display: none !important;
    }
}
