/* ==========================================================================
   Cold Chain Seafood MRP - Custom Enterprise SaaS Styling
   Clean White Palette, Subtle Elevations, 12px Border Radius, Modern Typography
   ========================================================================== */

:root {
    --erp-font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --erp-font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Theme Palette: Ocean Blue & Frost Cold Chain */
    --erp-primary: #0284c7;
    --erp-primary-dark: #0369a1;
    --erp-primary-light: #e0f2fe;
    --erp-primary-rgb: 2, 132, 199;

    --erp-navy-900: #0f172a;
    --erp-navy-800: #1e293b;
    --erp-navy-700: #334155;

    --erp-gray-50: #f8fafc;
    --erp-gray-100: #f1f5f9;
    --erp-gray-200: #e2e8f0;
    --erp-gray-300: #cbd5e1;
    --erp-gray-400: #94a3b8;
    --erp-gray-500: #64748b;
    --erp-gray-600: #475569;
    --erp-gray-700: #334155;

    /* Semantic Status */
    --erp-cold-cyan: #06b6d4;
    --erp-cold-bg: #ecfeff;
    --erp-cold-border: #a5f3fc;
    --erp-cold-text: #0891b2;

    --erp-success: #10b981;
    --erp-success-bg: #ecfdf5;
    --erp-warning: #f59e0b;
    --erp-warning-bg: #fffbeb;
    --erp-danger: #ef4444;
    --erp-danger-bg: #fef2f2;
    --erp-ai-purple: #8b5cf6;
    --erp-ai-bg: #f5f3ff;

    /* Component Geometry */
    --erp-radius: 12px;
    --erp-radius-sm: 8px;
    --erp-radius-lg: 16px;
    --erp-sidebar-width: 270px;
    --erp-header-height: 70px;

    /* Elevation Shadows */
    --erp-shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --erp-shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
    --erp-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --erp-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --erp-shadow-floating: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

/* Base Body Setup */
body {
    font-family: var(--erp-font-sans);
    background-color: var(--erp-gray-50);
    color: var(--erp-navy-800);
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* Card Styling: Clean White SaaS with Subtle Shadow & 12px Radius */
.card,
.erp-card {
    background-color: #ffffff;
    border: 1px solid var(--erp-gray-200);
    border-radius: var(--erp-radius) !important;
    box-shadow: var(--erp-shadow-sm);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}

.erp-card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--erp-shadow-md);
    border-color: #cbd5e1;
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--erp-gray-200);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--erp-navy-900);
    border-top-left-radius: var(--erp-radius) !important;
    border-top-right-radius: var(--erp-radius) !important;
}

.card-footer {
    background-color: var(--erp-gray-50);
    border-top: 1px solid var(--erp-gray-200);
    padding: 0.875rem 1.25rem;
    border-bottom-left-radius: var(--erp-radius) !important;
    border-bottom-right-radius: var(--erp-radius) !important;
}

/* ERP Layout Structure */
.erp-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar Styles */
.erp-sidebar {
    width: var(--erp-sidebar-width);
    background-color: #ffffff;
    border-right: 1px solid var(--erp-gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.erp-sidebar-brand {
    height: var(--erp-header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--erp-gray-200);
    text-decoration: none;
    background-color: #ffffff;
}

.erp-sidebar-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
}

.erp-sidebar-brand-text {
    margin-left: 0.75rem;
    line-height: 1.2;
}

.erp-sidebar-brand-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--erp-navy-900);
    letter-spacing: -0.02em;
}

.erp-sidebar-brand-subtitle {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--erp-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.erp-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 0.875rem;
}

.erp-nav-heading {
    font-size: 0.675rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--erp-gray-400);
    padding: 0.75rem 0.75rem 0.35rem 0.75rem;
}

.erp-nav-item {
    margin-bottom: 0.25rem;
}

.erp-nav-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    color: var(--erp-gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--erp-radius-sm);
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    position: relative;
}

.erp-nav-link i {
    font-size: 1.15rem;
    margin-right: 0.75rem;
    color: var(--erp-gray-400);
    transition: color 0.15s ease-in-out;
}

.erp-nav-link:hover {
    color: var(--erp-navy-900);
    background-color: var(--erp-gray-100);
}

.erp-nav-link:hover i {
    color: var(--erp-primary);
}

.erp-nav-link.active {
    color: var(--erp-primary-dark);
    background-color: #f0f9ff;
    font-weight: 600;
    border: 1px solid #bae6fd;
}

.erp-nav-link.active i {
    color: var(--erp-primary);
}

.erp-nav-badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
}

/* Call-to-action button in Mandor sidebar */
.erp-mandor-action-btn {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
    border: none;
}

.erp-mandor-action-btn:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35);
    transform: translateY(-1px);
}

.erp-mandor-action-btn i {
    color: #ffffff !important;
}

/* Main Content Area */
.erp-main {
    margin-left: var(--erp-sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* Top Header Bar */
.erp-header {
    height: var(--erp-header-height);
    background-color: #ffffff;
    border-bottom: 1px solid var(--erp-gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.03);
}

/* Header Telemetry Badges */
.erp-telemetry-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
}

.erp-badge-plant {
    background-color: #f8fafc;
    border-color: var(--erp-gray-200);
    color: var(--erp-navy-800);
}

.erp-badge-cold {
    background-color: var(--erp-cold-bg);
    border-color: var(--erp-cold-border);
    color: var(--erp-cold-text);
}

.erp-badge-shift {
    background-color: #fffbeb;
    border-color: #fef3c7;
    color: #b45309;
}

.erp-badge-ai {
    background-color: var(--erp-ai-bg);
    border-color: #ddd6fe;
    color: #6d28d9;
}

/* Pulsing Status Dot */
.erp-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: relative;
    display: inline-block;
}

.erp-pulse-dot.dot-green {
    background-color: #10b981;
}

.erp-pulse-dot.dot-cyan {
    background-color: #06b6d4;
    box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7);
    animation: erp-pulse-cyan 2s infinite;
}

.erp-pulse-dot.dot-amber {
    background-color: #f59e0b;
}

@keyframes erp-pulse-cyan {
    0% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.6);
    }
    70% {
        box-shadow: 0 0 0 7px rgba(6, 182, 212, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
    }
}

/* User Profile Nav */
.erp-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0369a1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    border: 2px solid #ffffff;
    box-shadow: var(--erp-shadow-xs);
}

/* Content Area */
.erp-content {
    flex: 1;
    padding: 1.75rem;
}

/* Tabular & Metric Displays */
.erp-metric-value {
    font-family: var(--erp-font-sans);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--erp-navy-900);
    line-height: 1.2;
    font-feature-settings: "tnum" 1;
}

.erp-metric-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--erp-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Buttons */
.btn-primary {
    background-color: var(--erp-primary);
    border-color: var(--erp-primary);
    border-radius: var(--erp-radius-sm);
    font-weight: 600;
    padding: 0.5rem 1rem;
    box-shadow: 0 1px 2px 0 rgba(2, 132, 199, 0.2);
    transition: all 0.15s ease-in-out;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--erp-primary-dark);
    border-color: var(--erp-primary-dark);
    box-shadow: 0 4px 8px 0 rgba(2, 132, 199, 0.3);
}

.btn-white {
    background-color: #ffffff;
    border: 1px solid var(--erp-gray-200);
    color: var(--erp-navy-800);
    border-radius: var(--erp-radius-sm);
    font-weight: 500;
    padding: 0.5rem 1rem;
    box-shadow: var(--erp-shadow-xs);
}

.btn-white:hover {
    background-color: var(--erp-gray-50);
    border-color: var(--erp-gray-300);
    color: var(--erp-navy-900);
}

/* Tables */
.table-erp {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: #f8fafc;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table-erp th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--erp-gray-500);
    background-color: var(--erp-gray-50);
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--erp-gray-200);
}

.table-erp td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: var(--erp-navy-800);
    vertical-align: middle;
    border-bottom: 1px solid var(--erp-gray-200);
}

.table-erp tr:last-child td {
    border-bottom: none;
}

/* Quick Role Switcher Pill (Dev & Plant Floor Demo Mode) */
.erp-role-pill {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-weight: 600;
}

/* Responsive Offcanvas/Drawer on Mobile */
@media (max-width: 991.98px) {
    .erp-sidebar {
        transform: translateX(-100%);
    }

    .erp-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--erp-shadow-floating);
    }

    .erp-main {
        margin-left: 0;
    }

    .erp-header {
        padding: 0 1rem;
    }

    .erp-content {
        padding: 1rem;
    }

    .erp-telemetry-cluster {
        display: none !important;
    }
}

/* Backdrop for Mobile Sidebar */
.erp-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1035;
}
