/* ==========================================================================
   Universal IMS - Deep Theme Override (Aggressive)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
    --universal-primary: #0ea5e9; /* Light, vibrant cyan-blue */
    --universal-primary-hover: #0284c7;
    --universal-bg: #f0f7ff; /* Very soft light blue */
    --universal-card: #ffffff;
    --universal-text: #334155;
    --universal-heading: #0f172a;
    --universal-border: #e2e8f0;
    --universal-shadow: 0 4px 20px -5px rgba(14, 165, 233, 0.08);
    --universal-radius: 6px;
    
    /* Bootstrap Overrides */
    --bs-primary: #0ea5e9 !important;
    --bs-success: #22c55e !important;
    
    /* Boxed Layout Background */
    --bs-body-bg: #f4f9ff !important;
}

body {
    background-color: var(--bs-body-bg) !important;
    font-family: 'Inter', sans-serif !important;
    color: var(--universal-text) !important;
}

/* ==========================================================================
   GLOBAL RESETS
   ========================================================================== */
html, body, [class*="bg-"] {
    font-family: 'Inter', sans-serif !important;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: 'Outfit', sans-serif !important;
    font-weight: 700 !important;
    color: var(--universal-heading) !important;
}

body, .layout-wrapper, .layout-container, .layout-page {
    background-color: var(--universal-bg) !important;
    color: var(--universal-text) !important;
}

/* ==========================================================================
   FLOATING SIDEBAR
   ========================================================================== */
.bg-menu-theme, .menu-vertical {
    background-color: var(--universal-card) !important;
    border: none !important;
    box-shadow: var(--universal-shadow) !important;
    margin: 0 0 0.5rem 0.5rem !important; /* Removed top margin */
    border-radius: 8px !important;
    height: calc(100vh - 0.5rem) !important; /* Adjust height */
}

.bg-menu-theme .menu-inner, .bg-menu-theme .menu-inner > .menu-item {
    background-color: transparent !important;
}

/* Hide Sneat's distinctive toggle circle */
.layout-menu-toggle {
    display: none !important;
}

/* Sidebar Links */
.bg-menu-theme .menu-link, .menu-vertical .menu-link {
    color: #475569 !important;
    border-radius: 8px !important;
    margin: 0.2rem 1rem !important;
    transition: all 0.2s ease !important;
}

.bg-menu-theme .menu-item:not(.active) > .menu-link:hover {
    background-color: #f8fafc !important;
    color: var(--universal-primary) !important;
}

/* Active Sidebar Item - OVERRIDE SNEAT'S UGLY BLUE (Top Level Only) */
.bg-menu-theme .menu-inner > .menu-item.active > .menu-link {
    background: rgba(14, 165, 233, 0.1) !important;
    color: var(--universal-primary) !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    border-left: 3px solid var(--universal-primary) !important;
    border-radius: 0 6px 6px 0 !important;
    margin-left: 0 !important;
    padding-left: 1rem !important;
}

/* Active Submenu Item (Don't break padding) */
.bg-menu-theme .menu-sub > .menu-item.active > .menu-link {
    color: var(--universal-primary) !important;
    font-weight: 600 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-left: none !important;
}

.bg-menu-theme .menu-item.active > .menu-link i,
.bg-menu-theme .menu-item.active > .menu-link div {
    color: var(--universal-primary) !important;
}

.app-brand {
    border-bottom: 1px solid var(--universal-border) !important;
    padding: 1.5rem 1rem !important;
}

/* ==========================================================================
   FLOATING NAVBAR & SPACING
   ========================================================================== */
.layout-navbar, .bg-navbar-theme {
    background-color: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    box-shadow: var(--universal-shadow) !important;
    border: none !important;
    margin: 0 0.5rem 1rem 0 !important; /* Left 0 to match page card, right 0.5rem */
    border-radius: 8px !important;
    width: auto !important;
}

/* Adjust page container padding to properly align next to floating sidebar */
@media (min-width: 1200px) {
    .layout-menu-fixed .layout-page, .layout-menu-fixed-offcanvas .layout-page {
        padding-left: calc(16.25rem + 1rem) !important; /* Sidebar is 16.25 + 0.5 margin. This adds a 0.5rem gap perfectly */
    }
}

.content-wrapper {
    padding-right: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    padding-left: 0 !important;
}

/* Force container to be fluid so it doesn't center and create massive gaps on wide screens */
/* Also turn it into a Global Main Card as requested */
.content-wrapper > .container-xxl, 
.content-wrapper > .container-fluid {
    max-width: 100% !important;
    background-color: #ffffff !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px -5px rgba(14, 165, 233, 0.05) !important;
    border: 1px solid #e2e8f0 !important;
    padding: 1.5rem !important;
    min-height: calc(100vh - 6rem);
    margin-bottom: 0.5rem;
}

/* Ensure the navbar's inner container is just fluid and doesn't become a giant card */
.layout-navbar .container-xxl,
.layout-navbar .container-fluid {
    max-width: 100% !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    min-height: 0 !important;
    padding: 0 1.5rem !important;
}

/* Remove default template top gap */
.container-p-y:not([class^="pb-"]):not([class*=" pb-"]) {
    padding-top: 1.5rem !important; /* Restored padding since it is now inside the white card */
}

/* ==========================================================================
   CARDS & CONTAINERS
   ========================================================================== */
.card, .panel {
    background-color: var(--universal-card) !important;
    border: none !important;
    border-radius: var(--universal-radius) !important;
    box-shadow: var(--universal-shadow) !important;
    margin-bottom: 1.5rem !important;
}

.card-header {
    background-color: transparent !important;
    border-bottom: 1px solid var(--universal-border) !important;
    padding: 1.5rem !important;
}

.card-body {
    padding: 1.5rem !important;
}

/* ==========================================================================
   BUTTONS (Primary Color Overrides)
   ========================================================================== */
.btn-primary, .bg-primary, .nav-pills .nav-link.active {
    background-color: var(--universal-primary) !important;
    border-color: var(--universal-primary) !important;
    color: white !important;
    box-shadow: 0 2px 8px 0 rgba(14, 165, 233, 0.2) !important;
    border-radius: 6px !important;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--universal-primary-hover) !important;
    border-color: var(--universal-primary-hover) !important;
    box-shadow: 0 4px 12px 0 rgba(14, 165, 233, 0.3) !important;
    transform: translateY(-1px) !important;
}

.text-primary {
    color: var(--universal-primary) !important;
}

/* ==========================================================================
   INPUTS
   ========================================================================== */
.form-control, .form-select {
    border-radius: 6px !important;
    border: 1px solid #cbd5e1 !important;
    padding: 0.5rem 0.875rem !important;
    box-shadow: none !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--universal-primary) !important;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15) !important;
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-responsive {
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    margin-bottom: 1rem;
}

.table {
    margin-bottom: 0 !important;
}

.table th {
    font-family: 'Outfit', sans-serif !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    font-size: 0.75rem !important;
    color: #475569 !important;
    font-weight: 700 !important;
    background-color: #f1f5f9 !important;
    border-bottom: 2px solid #e2e8f0 !important;
    padding: 1rem 1rem !important;
}

.table td {
    padding: 1rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
    color: var(--universal-text) !important;
    vertical-align: middle !important;
}

.table tbody tr {
    transition: all 0.2s ease;
}
.table tbody tr:hover td {
    background-color: #f8fafc !important;
}

.table tbody tr:last-child td {
    border-bottom: none !important;
}

/* Dashboard specific overrides */
.card-title {
    font-family: 'Outfit', sans-serif !important;
    color: var(--universal-heading) !important;
}

/* ==========================================================================
   ERP LOGIN PAGE STYLES (Split Screen - Form Left, Visual Right)
   ========================================================================== */
.erp-login-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%; /* Avoid 100vw which causes horizontal scroll */
    overflow: hidden;
    background-color: #ffffff;
    position: relative;
}

/* Animated top gradient bar */
.erp-login-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4338ca, #3b82f6, #10b981, #f59e0b, #ef4444, #4338ca);
    background-size: 200% 100%;
    animation: gradientMove 3s linear infinite;
    z-index: 20;
}

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

.erp-form-logo {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 2rem;
}

.erp-form-logo img {
    height: 45px;
    width: auto;
}

@media (max-width: 991px) {
    .erp-form-logo {
        justify-content: center; /* Center on mobile */
    }
}

/* FORM SIDE (LEFT) */
.erp-login-form-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    background-color: #ffffff;
    z-index: 10;
    overflow-y: auto; /* Allow form side to scroll if screen is very short */
}

@media (min-width: 992px) {
    .erp-login-form-side {
        max-width: 50%;
        padding: 2rem;
    }
}

.erp-login-form-container {
    width: 100%;
    max-width: 400px; /* Slightly narrower to fit better */
    margin: auto 0; /* Center vertically */
}

.erp-login-brand {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.erp-login-brand img {
    height: 48px;
    width: auto;
}

.erp-form-control {
    border-radius: 8px;
    padding: 0.75rem 1rem 0.75rem 3rem; /* Slightly reduced padding */
    border: 1px solid var(--universal-border);
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    color: var(--universal-text);
    background-color: #f8fafc;
}

.erp-form-control:focus {
    border-color: #4338ca;
    box-shadow: 0 0 0 4px rgba(67, 56, 202, 0.1);
    background-color: #ffffff;
}

.erp-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    z-index: 10;
    font-size: 1.25rem;
}

.erp-btn-primary {
    background-color: #4338ca;
    border: none;
    padding: 0.75rem 1.5rem; /* Slightly reduced padding */
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    color: white;
    width: 100%;
}

.erp-btn-primary:hover {
    background-color: #3730a3;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(67, 56, 202, 0.25);
}

.erp-link-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.erp-btn-outline {
    flex: 1;
    text-align: center;
    padding: 0.5rem 1rem;
    border: 1px solid var(--universal-border);
    border-radius: 8px;
    color: var(--universal-text);
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 0.85rem;
}

.erp-btn-outline:hover {
    border-color: #4338ca;
    color: #4338ca;
    background-color: rgba(67, 56, 202, 0.05);
}

/* VISUAL SIDE (RIGHT) */
.erp-login-visual-side {
    flex: 1;
    display: none; /* Hidden on mobile */
    position: relative;
    background-color: #eef2f6;
    overflow: hidden;
    color: var(--universal-heading);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 2rem;
}

@media (min-width: 992px) {
    .erp-login-visual-side {
        display: flex;
    }
}

.erp-login-visual-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
    text-align: center;
    margin-bottom: 2rem; /* Reduced to save vertical space */
}

.erp-login-visual-content h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    color: #1e293b !important;
    line-height: 1.2;
}

.erp-login-visual-content p {
    font-size: 1rem;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 0;
}

.erp-login-visual-image {
    width: 100%;
    max-width: 550px;
    max-height: 45vh; /* Keep it from taking over the screen height */
    object-fit: cover; /* Prevent stretching */
    border-radius: 12px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transform: perspective(1000px) rotateY(-5deg) rotateX(5deg);
    transition: transform 0.5s ease;
}

.erp-login-visual-image:hover {
    transform: perspective(1000px) rotateY(0deg) rotateX(0deg);
}
