/* ==========================================================================
   ProdPlan PRO — "One Glass Material" Design System
   Blends Samsung One UI squircle ergonomics, Apple Liquid Glass translucency,
   and Android Material 3 expressive tonal surfaces.
   ========================================================================== */

:root {
    --surface-canvas: #f4f6fb;
    --surface-glass: rgba(255, 255, 255, 0.78);
    --surface-glass-strong: rgba(255, 255, 255, 0.92);
    --surface-tonal: #eef2ff;
    --border-hairline: rgba(15, 23, 42, 0.08);
    --border-specular: rgba(255, 255, 255, 0.85);
    --shadow-glass:
        0 10px 30px -10px rgba(15, 23, 42, 0.07),
        0 1px 3px rgba(15, 23, 42, 0.04),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
    --shadow-glass-hover:
        0 20px 42px -12px rgba(79, 70, 229, 0.14),
        0 4px 12px rgba(15, 23, 42, 0.05),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.95);
    --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

[x-cloak] {
    display: none !important;
}

/* Material Symbols Rounded & Outlined smooth optical tuning */
.material-symbols-rounded,
.material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 450, 'GRAD' 0, 'opsz' 24;
    user-select: none;
    line-height: 1;
}

/* Ambient spatial mesh background (Apple / Material You atmosphere) */
body.app-shell-bg {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--surface-canvas);
    background-image:
        radial-gradient(ellipse 65% 50% at 8% -5%, rgba(99, 102, 241, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 55% 45% at 92% 0%, rgba(14, 165, 233, 0.10) 0%, transparent 55%),
        radial-gradient(ellipse 60% 50% at 50% 105%, rgba(168, 85, 247, 0.07) 0%, transparent 60%);
    background-attachment: fixed;
    color: #0f172a;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Samsung One UI + Apple Liquid Glass Squircle Cards */
.glass-panel,
.bento-card,
.card {
    background: var(--surface-glass);
    backdrop-filter: blur(24px) saturate(165%);
    -webkit-backdrop-filter: blur(24px) saturate(165%);
    border: 1px solid var(--border-hairline);
    border-radius: 1.75rem; /* 28px One UI / Apple squircle */
    box-shadow: var(--shadow-glass);
    transition: transform 0.35s var(--ease-spring), box-shadow 0.35s var(--ease-spring), border-color 0.25s ease, background-color 0.25s ease;
}

.bento-card:hover,
.glass-panel-hover:hover {
    background: var(--surface-glass-strong);
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: var(--shadow-glass-hover);
}

.bento-card-interactive:hover {
    transform: translateY(-2px);
}

/* Elevated Hero / Dark Spatial Glass Panel (Apple Control Center / Material Dark Container) */
.spatial-dark-card {
    background: linear-gradient(145deg, #0f172a 0%, #1e1b4b 55%, #172554 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1.75rem;
    box-shadow:
        0 24px 48px -14px rgba(15, 23, 42, 0.45),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.16);
    color: #f8fafc;
}

/* Material 3 Tonal KPI Pill Badges */
.m3-kpi-pill {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1.375rem;
    box-shadow: 0 6px 20px -8px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-spring);
}

.m3-kpi-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px -10px rgba(79, 70, 229, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* Premium Apple / Samsung Squircle 3D Glass Icons */
.icon-3d {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 0.82rem; /* Apple/OneUI squircle ratio */
    overflow: hidden;
    flex-shrink: 0;
    transition: transform 0.35s var(--ease-spring), box-shadow 0.35s var(--ease-spring);
    box-shadow:
        0 8px 18px -4px var(--glow-color, rgba(99, 102, 241, 0.42)),
        0 2px 4px -1px rgba(15, 23, 42, 0.12),
        inset 0 1.5px 1px 0 rgba(255, 255, 255, 0.72),
        inset 0 -2px 3px 0 rgba(0, 0, 0, 0.22);
}

/* Specular diagonal glass sheen on icons */
.icon-3d::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.06) 48%, rgba(0, 0, 0, 0.06) 100%);
    pointer-events: none;
}

.icon-3d.icon-lg {
    width: 46px;
    height: 46px;
    border-radius: 1rem;
}

.icon-3d.icon-sm {
    width: 30px;
    height: 30px;
    border-radius: 0.65rem;
}

.icon-3d .material-symbols-outlined,
.icon-3d .material-symbols-rounded,
.icon-3d svg {
    position: relative;
    z-index: 1;
    color: #ffffff;
    font-size: 19px;
    filter: drop-shadow(0 1.5px 2px rgba(0, 0, 0, 0.28));
    transition: transform 0.3s var(--ease-spring);
}

.icon-3d.icon-lg .material-symbols-outlined,
.icon-3d.icon-lg .material-symbols-rounded {
    font-size: 24px;
}

.icon-3d.icon-sm .material-symbols-outlined,
.icon-3d.icon-sm .material-symbols-rounded {
    font-size: 16px;
}

/* Floating Top Glass Dock Navigation (macOS / One UI) */
.top-nav {
    position: fixed;
    z-index: 50;
    transition: all 0.35s var(--ease-spring);
}

@media (min-width: 1024px) {
    .top-nav {
        top: 0.75rem;
        left: 1rem;
        right: 1rem;
        margin-left: auto;
        margin-right: auto;
        max-width: 96rem;
        border-radius: 1.6rem;
        background: rgba(255, 255, 255, 0.78);
        backdrop-filter: blur(28px) saturate(185%);
        -webkit-backdrop-filter: blur(28px) saturate(185%);
        border: 1px solid rgba(255, 255, 255, 0.9);
        box-shadow:
            0 18px 44px -14px rgba(15, 23, 42, 0.12),
            0 2px 6px rgba(15, 23, 42, 0.04),
            inset 0 1px 0 rgba(255, 255, 255, 0.95);
        height: 4.85rem;
    }
    body.app-shell-bg {
        padding-top: 7.1rem;
    }
}

@media (max-width: 1023px) {
    .top-nav {
        top: 0;
        left: 0;
        right: 0;
        height: 4rem;
        background: rgba(255, 255, 255, 0.88);
        backdrop-filter: blur(20px) saturate(170%);
        -webkit-backdrop-filter: blur(20px) saturate(170%);
        border-bottom: 1px solid rgba(226, 232, 240, 0.85);
        box-shadow: 0 4px 16px -4px rgba(15, 23, 42, 0.07);
    }
    body.app-shell-bg {
        padding-top: 5rem;
    }
}

.top-nav-link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.65rem;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    border-radius: 1.1rem;
    transition: all 0.28s var(--ease-spring);
}

.top-nav-link:hover {
    color: #0f172a;
    background: rgba(241, 245, 249, 0.75);
}

.top-nav-link:hover .icon-3d {
    transform: translateY(-3px) scale(1.1);
}

.top-nav-link:hover .icon-3d .material-symbols-outlined,
.top-nav-link:hover .icon-3d .material-symbols-rounded {
    transform: scale(1.06);
}

.top-nav-link.active {
    color: #0f172a;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(99, 102, 241, 0.22);
    box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.22), inset 0 1px 0 rgba(255, 255, 255, 1);
}

.top-nav-link.active .icon-3d {
    transform: translateY(-1px) scale(1.05);
    outline: 2px solid rgba(255, 255, 255, 0.9);
}

.top-nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.22rem;
    width: 1.15rem;
    height: 0.22rem;
    background: linear-gradient(90deg, #4f46e5, #0ea5e9);
    border-radius: 9999px;
}

/* Mobile Sidebar Links */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.72rem 0.95rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    border-radius: 1.15rem;
    transition: all 0.25s var(--ease-spring);
}

.sidebar-link:hover {
    background: rgba(241, 245, 249, 0.9);
}

.sidebar-link.active {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #ffffff;
    box-shadow: 0 10px 24px -6px rgba(79, 70, 229, 0.45);
}

.sidebar-link.active span {
    color: #ffffff !important;
}

.sidebar-link.active .icon-3d {
    box-shadow: none !important;
    background: rgba(255, 255, 255, 0.22) !important;
}

/* Material 3 Inputs, Controls & Tactile Buttons */
.input-field {
    display: block;
    width: 100%;
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid rgba(203, 213, 225, 0.85);
    border-radius: 1rem;
    padding: 0.62rem 0.95rem;
    font-size: 0.875rem;
    color: #0f172a;
    transition: all 0.22s var(--ease-spring);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.input-field::placeholder {
    color: #94a3b8;
}

.input-field:focus {
    outline: none;
    background: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14), 0 4px 12px -4px rgba(99, 102, 241, 0.12);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.625rem 1.25rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 20px -6px rgba(15, 23, 42, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.16);
    transition: all 0.25s var(--ease-spring);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
    box-shadow: 0 12px 24px -6px rgba(15, 23, 42, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-gradient {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #7c3aed 100%);
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.625rem 1.25rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 24px -6px rgba(79, 70, 229, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.32);
    transition: all 0.25s var(--ease-spring);
}

.btn-gradient:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 14px 28px -6px rgba(79, 70, 229, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-gradient:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-gradient:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(203, 213, 225, 0.85);
    color: #334155;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.625rem 1.2rem;
    border-radius: 1rem;
    box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: all 0.25s var(--ease-spring);
}

.btn-secondary:hover:not(:disabled) {
    background: #ffffff;
    border-color: rgba(99, 102, 241, 0.35);
    color: #0f172a;
    transform: translateY(-1px);
    box-shadow: 0 8px 16px -6px rgba(15, 23, 42, 0.1);
}

.btn-secondary:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(254, 226, 226, 0.72);
    border: 1px solid rgba(244, 63, 94, 0.18);
    color: #e11d48;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.5rem 0.85rem;
    border-radius: 0.9rem;
    transition: all 0.22s var(--ease-spring);
}

.btn-logout:hover {
    background: #ffe4e6;
    color: #be123c;
    transform: translateY(-1px);
}

/* One UI Section Eyebrow Pill */
.oneui-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.85rem;
    border-radius: 9999px;
    background: rgba(238, 242, 255, 0.85);
    border: 1px solid rgba(99, 102, 241, 0.22);
    color: #4338ca;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

/* Material 3 Segmented Pill Bar */
.m3-segmented {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem;
    background: rgba(241, 245, 249, 0.92);
    border: 1px solid rgba(203, 213, 225, 0.65);
    border-radius: 1rem;
    gap: 0.2rem;
}

.m3-segmented-btn {
    padding: 0.42rem 0.85rem;
    border-radius: 0.78rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    transition: all 0.22s var(--ease-spring);
}

.m3-segmented-btn.active {
    background: #ffffff;
    color: #4f46e5;
    box-shadow: 0 3px 10px -2px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 1);
}

/* Premium Glass Data Table */
.glass-table thead th {
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96) 0%, rgba(241, 245, 249, 0.96) 100%);
    backdrop-filter: blur(8px);
}

.glass-table tbody tr {
    transition: background-color 0.18s ease;
}

/* Micro Animations */
@keyframes floatSubtle {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-3px); }
}

.animate-float-subtle {
    animation: floatSubtle 5s ease-in-out infinite;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.55);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.75);
}

/* TomSelect Modern Material 3 Glass Styling */
.ts-wrapper .ts-control {
    border-radius: 1rem !important;
    border-color: rgba(203, 213, 225, 0.85) !important;
    background: rgba(248, 250, 252, 0.9) !important;
    padding: 0.45rem 0.75rem !important;
    font-size: 0.8125rem !important;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03) !important;
}

.ts-wrapper.focus .ts-control {
    background: #ffffff !important;
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14) !important;
}

.ts-wrapper .ts-dropdown {
    border-radius: 1.15rem !important;
    border-color: rgba(203, 213, 225, 0.85) !important;
    box-shadow: 0 20px 40px -12px rgba(15, 23, 42, 0.18) !important;
    overflow: hidden;
}

/* Flatpickr Modern Glass Theme Override */
.flatpickr-calendar {
    border-radius: 1.35rem !important;
    border: 1px solid rgba(203, 213, 225, 0.85) !important;
    box-shadow: 0 24px 50px -12px rgba(15, 23, 42, 0.2) !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    overflow: hidden;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
    border-color: transparent !important;
}
