html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* ERP Modern Sidebar & Layout */
:root {
    --sidebar-width: 250px;
    --erp-primary: #4e73df;
    --erp-secondary: #858796;
    --erp-success: #1cc88a;
    --erp-info: #36b9cc;
    --erp-warning: #f6c23e;
    --erp-danger: #e74a3b;
    --erp-dark: #5a5c69;
    --erp-light: #f8f9fc;
    --erp-sidebar-bg: #4e73df;
    --erp-sidebar-active: rgba(255, 255, 255, 0.2);
    --erp-sidebar-text: rgba(255, 255, 255, 0.8);
    --erp-card-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

body {
    background-color: var(--erp-light);
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow-x: hidden;
}

#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background-image: linear-gradient(180deg, #4e73df 10%, #224abe 100%);
    color: #fff;
    transition: all 0.3s;
    min-height: 100vh;
    position: fixed;
    right: 0;
    z-index: 1000;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

#content {
    width: 100%;
    padding: 0;
    margin-right: var(--sidebar-width);
    transition: all 0.3s;
    min-height: 100vh;
}

#sidebar .sidebar-header {
    padding: 1.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#sidebar .sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    color: #fff;
}

#sidebar ul.components {
    padding: 1rem 0;
}

#sidebar ul li a {
    padding: 0.75rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    color: var(--erp-sidebar-text) !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

#sidebar ul li a:hover {
    color: #fff !important;
    background: var(--erp-sidebar-active);
}

#sidebar ul li.active > a {
    color: #fff !important;
    background: var(--erp-sidebar-active);
    position: relative;
}

#sidebar ul li.active > a::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #fff;
}

#sidebar ul li a i {
    margin-left: 0.75rem;
    width: 1.25rem;
    text-align: center;
    font-size: 0.9rem;
}

/* Sidebar Dropdowns */
#sidebar ul li a[data-bs-toggle="collapse"] {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#sidebar ul li a[data-bs-toggle="collapse"]::after {
    display: inline-block;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    content: "\f107";
    transition: transform 0.3s ease;
}

#sidebar ul li a[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

.collapse-inner {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    margin: 0 0.5rem 0.5rem 0.5rem;
    border-radius: 0.35rem;
}

.collapse-inner a {
    padding: 0.5rem 1.5rem !important;
    font-size: 0.8rem !important;
    font-weight: 400 !important;
}

.collapse-inner a:hover {
    background: transparent !important;
    color: #fff !important;
    padding-right: 2rem !important;
}

/* Sidebar Headings */
.sidebar-heading {
    padding: 0.75rem 1.5rem;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
}

/* Interactive Cards */
.card {
    border: none;
    box-shadow: var(--erp-card-shadow);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border-radius: 0.5rem;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.25);
}

.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    padding: 1rem 1.25rem;
}

/* Top Navbar Styling */
.top-navbar {
    background: #fff;
    height: 4.375rem;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    position: sticky;
    top: 0;
    z-index: 999;
}

.search-container {
    background: #f8f9fc;
    border: 1px solid #d1d3e2;
    border-radius: 0.35rem;
    padding: 0.375rem 0.75rem;
    width: 100%;
    max-width: 400px;
    display: flex;
    align-items: center;
}

.search-container input {
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.85rem;
    color: #6e707e;
}

/* Buttons with interactions */
.btn {
    border-radius: 0.35rem;
    font-weight: 700;
    padding: 0.375rem 0.75rem;
    transition: all 0.2s ease;
}

.btn-primary { background-color: var(--erp-primary); border-color: var(--erp-primary); }
.btn-primary:hover { background-color: #2e59d9; border-color: #2653d4; transform: scale(1.02); }

/* Table Styling */
.table {
    color: #858796;
}

.table thead th {
    background-color: #f8f9fc;
    border-bottom: 2px solid #e3e6f0;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #4e73df;
}

.table-hover tbody tr:hover {
    background-color: rgba(78, 115, 223, 0.05);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

main {
    animation: fadeIn 0.4s ease-out;
}

/* Stats Widgets */
.stat-card {
    border-right: 0.25rem solid !important;
}

.stat-card-primary { border-right-color: var(--erp-primary) !important; }
.stat-card-success { border-right-color: var(--erp-success) !important; }
.stat-card-info { border-right-color: var(--erp-info) !important; }
.stat-card-warning { border-right-color: var(--erp-warning) !important; }

.stat-label { font-size: 0.7rem; font-weight: 800; color: #4e73df; text-transform: uppercase; margin-bottom: 0.25rem; }
.stat-value { font-size: 1.25rem; font-weight: 700; color: #5a5c69; }
.stat-icon { font-size: 2rem; color: #dddfeb; }


/* Fix for blue links in sidebar */
#sidebar a, #sidebar a:visited, #sidebar a:hover, #sidebar a:active {
    color: #abb4be;
    text-decoration: none;
}

/* Top Navbar - Zoho Style Fix */
.top-navbar {
    background: #fff;
    height: 60px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e1e4e8;
    position: sticky;
    top: 0;
    z-index: 999;
    direction: ltr; /* Layout container is LTR to match your image (Profile Left, Logo Right) */
}

.top-navbar > * {
    direction: rtl; /* Contents inside are RTL */
}

.search-container {
    background: #f1f3f6;
    border-radius: 4px;
    padding: 5px 15px;
    width: 100%;
    max-width: 450px;
    display: flex;
    align-items: center;
    margin: 0 20px;
}

.search-container input {
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    padding: 5px;
    font-size: 0.9rem;
    text-align: right;
}

.header-icons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icons .icon-btn {
    color: #555 !important;
    font-size: 1.1rem;
    cursor: pointer;
    text-decoration: none;
}

.header-icons .plus-btn {
    background: var(--erp-primary);
    color: #fff !important;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    text-decoration: none;
}

.user-profile img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
}

.logo-area h5 {
    font-size: 1.1rem;
    white-space: nowrap;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-profile img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid #eee;
}

/* ERP Widget Cards */
.erp-widget {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--erp-card-shadow);
    height: 100%;
    border: 1px solid #e1e4e8;
}

.erp-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.erp-widget-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.erp-widget-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.erp-widget-body .empty-icon {
    color: #e1e4e8;
    font-size: 3rem;
    margin-bottom: 10px;
}

.erp-widget-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--erp-primary);
}

.erp-btn-primary {
    background: var(--erp-primary);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}

.erp-btn-primary:hover {
    background: #0b5ed7;
    color: #fff;
}

/* Custom Chart Placeholder Styles */
.gauge-container {
    position: relative;
    width: 200px;
    height: 100px;
    overflow: hidden;
}

.gauge-body {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: #e1e4e8;
    position: relative;
}

.gauge-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--erp-primary);
    transform-origin: center center;
    transform: rotate(45deg); /* Example fill */
    clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
}

.gauge-inner {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: #fff;
    z-index: 2;
}

.gauge-needle {
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 2px;
    height: 80px;
    background: #333;
    transform-origin: bottom center;
    transform: rotate(-45deg);
    z-index: 3;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}