/*
  Modern Minimal Theme
  - Typography: Inter
  - Colorful yet minimal using CSS variables already defined
  - Rounded, roomy spacing, subtle shadows
  - Works with existing markup; purely progressive enhancement
*/

:root {
  /* Light as default (Rentila-like) */
  --surface-bg: #f6f8fb;
  --surface-contrast: #ffffff;
  --text-primary: #0f172a; /* slate-900 */
  --text-secondary: #475569; /* slate-600 */
  --border-color: rgba(15, 23, 42, 0.08);
  --card-bg: #ffffff;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow-sm: 0 8px 22px rgba(2, 6, 23, 0.06);
  --shadow-xs: 0 2px 8px rgba(2, 6, 23, 0.06);
}

/* Dark theme overrides */
[data-theme='dark'] {
  --surface-bg: #0f172a;
  --surface-contrast: #0b1220;
  --text-primary: #e5e7eb;
  --text-secondary: #94a3b8;
  --border-color: rgba(148, 163, 184, 0.18);
  --card-bg: #0b1220;
  --shadow-sm: 0 6px 18px rgba(2, 6, 23, 0.24);
  --shadow-xs: 0 2px 8px rgba(2, 6, 23, 0.22);
}

html, body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji" !important;
  background: linear-gradient(180deg, var(--surface-bg), #eef2f7);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[data-theme='dark'] body, [data-theme='dark'] html {
  background: linear-gradient(180deg, var(--surface-bg), #0a0f1c);
}

/* Global links & focus */
a { color: var(--primary-color); }
a:hover { color: var(--secondary-color); text-decoration: none; }

:focus { outline: 2px solid var(--secondary-color); outline-offset: 2px; }

/* Containers */
.container, .container-fluid { padding-left: 18px; padding-right: 18px; }

/* Cards and panels */
.card, .panel, .modal-content, .dropdown-menu, .venobox, .simplebar-content-wrapper,
.form-control, .select2-container .select2-selection--single {
  background-color: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-lg) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-sm);
}

.card-header, .panel-heading { background: transparent; border-bottom: 1px solid var(--border-color); }
.card-title { font-weight: 600; letter-spacing: -.01em; }

.dropdown-menu { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

.modal-header, .modal-footer { border-color: var(--border-color) !important; }

/* Headers / Topbar */
#page-topbar, .navbar, .navbar-header {
  background: var(--surface-contrast);
  border-bottom: 1px solid var(--border-color);
}

.navbar-brand-box img { height: 28px; }

.header-item {
  color: var(--text-secondary) !important;
  border-radius: var(--radius-sm);
}

.header-item:hover { color: var(--text-primary) !important; background: rgba(148,163,184,0.08); }

/* Theme toggle button */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border-color);
  color: var(--text-secondary); background: transparent;
}
.theme-toggle:hover { color: var(--text-primary); background: rgba(148,163,184,0.08); }

/* Sidebar */
.vertical-menu {
  background: var(--surface-contrast);
  border-right: 1px solid var(--border-color);
  width: 240px;
}

#sidebar-menu .metismenu a {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-secondary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  position: relative;
}

#sidebar-menu .metismenu i { font-size: 18px; opacity: .9; }

#sidebar-menu .metismenu a:hover, #sidebar-menu .metismenu .mm-active > a,
#sidebar-menu .metismenu a.active {
  color: var(--text-primary);
  background: rgba(15, 23, 42, 0.04);
}

/* Active left indicator */
#sidebar-menu .metismenu .mm-active > a::before, #sidebar-menu .metismenu a.active::before {
  content: '';
  position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: var(--primary-color);
  border-radius: 2px;
}

/* Sidebar submenu */
#sidebar-menu .sub-menu { padding-left: 12px; }
#sidebar-menu .sub-menu li a { padding: 8px 12px; border-radius: 8px; }
#sidebar-menu .sub-menu li a:hover { background: rgba(15,23,42,0.04); }

/* Buttons */

.btn, button, .theme-link { border-radius: 10px !important; transition: transform .05s ease, box-shadow .2s ease; }

.btn-primary, .theme-btn, .theme-link {
  background: var(--primary-color) !important;
  border: 1px solid var(--primary-color) !important;
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(54,134,252,0.22);
}

.btn-primary:hover, .theme-link:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.btn-outline-primary { color: var(--primary-color) !important; border-color: var(--primary-color) !important; }

.btn-outline-primary:hover { background: var(--primary-color) !important; color: #fff !important; }

/* Forms */
.form-control, .select2-selection__rendered { background: #ffffff !important; color: var(--text-primary) !important; }

.form-control:focus { border-color: var(--primary-color) !important; box-shadow: 0 0 0 3px rgba(54,134,252,0.18) !important; }

label { color: var(--text-secondary); font-weight: 500; }

/* Tables */
table { color: var(--text-primary); background: var(--surface-contrast); }
thead th { color: var(--text-secondary); border-bottom: 1px solid var(--border-color) !important; font-weight: 600; text-transform: none; }
tbody tr { border-bottom: 1px solid var(--border-color); }
tbody tr:hover { background: rgba(15,23,42,0.04); }

/* Badges / Pills */
.badge, .label { border-radius: 999px; padding: 6px 10px; }

/* Toastr */
.toast { background: var(--card-bg); color: var(--text-primary); }

/* Utilities */
.rounded-soft { border-radius: var(--radius-lg) !important; }
.shadow-soft { box-shadow: var(--shadow-sm) !important; }
.muted { color: var(--text-secondary) !important; }

/* Login / Auth pages */
.auth-wrapper {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1000px 400px at 10% -20%, rgba(54,134,252,.25), transparent 60%),
              radial-gradient(800px 300px at 100% 0%, rgba(130,83,251,.22), transparent 70%),
              linear-gradient(180deg, var(--surface-bg), #0a0f1c);
}

.auth-card { padding: 28px; }

/* Frontend general content areas */
section, .content, .page-content, .main-content { color: var(--text-primary); }

/* Footer */
footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
}
/* Page header / breadcrumbs area */
.page-title-box, .content-header { background: var(--surface-contrast); border-bottom: 1px solid var(--border-color); padding: 14px 18px; margin-bottom: 12px; border-radius: 12px; box-shadow: var(--shadow-xs); }
.page-title, .content-title { font-size: 20px; font-weight: 700; margin: 0; }

/* RTL tweaks inherit existing logic */
.direction-rtl #sidebar-menu .metismenu a { justify-content: flex-end; }

/* Collapsed sidebar behavior */
body.vertical-collpsed .vertical-menu { width: 80px; }
body.vertical-collpsed .vertical-menu #sidebar-menu .metismenu a span { display: none; }
body.vertical-collpsed .vertical-menu #sidebar-menu .metismenu i { font-size: 20px; margin-right: 0; }
body.vertical-collpsed .vertical-menu #sidebar-menu .metismenu a { justify-content: center; padding: 12px; }

/* Breadcrumbs */
.breadcrumb { background: transparent; margin-bottom: 12px; }
.breadcrumb .breadcrumb-item, .breadcrumb a { color: var(--text-secondary); }
.breadcrumb .breadcrumb-item.active { color: var(--text-primary); }

/* Tabs */
.nav-tabs { border-bottom: 1px solid var(--border-color) !important; gap: 8px; }
.nav-tabs .nav-link { color: var(--text-secondary); border: none; margin-right: 0; padding: 10px 12px; border-bottom: 2px solid transparent; border-radius: 0; }
.nav-tabs .nav-link.active, .nav-tabs .nav-link:hover { color: var(--text-primary); background: transparent; border-bottom-color: var(--primary-color); }

/* Pagination */
.pagination { gap: 2px; }
.pagination .page-link { background: #ffffff; border: 1px solid var(--border-color); color: var(--text-secondary); border-radius: 12px; margin: 0 4px; padding: 8px 12px; }
.pagination .page-item.disabled .page-link { opacity: .6; }
.pagination .page-item.active .page-link {
  background: var(--primary-color); border-color: var(--primary-color); color: #fff;
}
.pagination .page-link:hover { color: var(--text-primary); }

/* Alerts */
.alert { border-radius: 12px; border: 1px solid var(--border-color); color: var(--text-primary); }
.alert-primary { background: linear-gradient(90deg, rgba(54,134,252,.15), rgba(130,83,251,.15)); border: none; }
.alert-success { background: linear-gradient(90deg, rgba(16,185,129,.18), rgba(59,130,246,.14)); border: none; }
.alert-danger { background: linear-gradient(90deg, rgba(239,68,68,.18), rgba(244,114,182,.16)); border: none; }
.alert-warning { background: linear-gradient(90deg, rgba(245,158,11,.2), rgba(250,204,21,.16)); border: none; }

/* Badges */
.badge-primary { background: linear-gradient(90deg, var(--primary-color), var(--secondary-color)); }
.badge-success { background: linear-gradient(90deg, #10b981, #3b82f6); }
.badge-danger { background: linear-gradient(90deg, #ef4444, #f43f5e); }
.badge-warning { background: linear-gradient(90deg, #f59e0b, #fbbf24); color: #0b1220; }
.badge-info { background: linear-gradient(90deg, #06b6d4, #60a5fa); }

/* Tables density & hover */
.table { border-color: var(--border-color) !important; }
.table thead th { font-weight: 600; letter-spacing: .2px; }
.table-hover tbody tr:hover { background: rgba(148,163,184,.06) !important; }
.table > :not(caption) > * > * { background-color: transparent; }
.table-striped > tbody > tr:nth-of-type(odd) { background-color: rgba(15,23,42,.025); }

/* Input groups & checks */
.input-group-text { background: #ffffff; border-color: var(--border-color); color: var(--text-secondary); }
.form-check-input { background-color: #ffffff; border-color: var(--border-color); }
.form-check-input:checked { background-color: var(--primary-color); border-color: var(--primary-color); }

/* Dropdown items */
.dropdown-item { color: var(--text-secondary); }
.dropdown-item:hover, .dropdown-item:focus { color: var(--text-primary); background: rgba(148,163,184,0.06); }

/* Shadows on hover for cards */
.card:hover { box-shadow: 0 10px 28px rgba(2,6,23,.08); transform: translateY(-1px); transition: all .15s ease; }

/* Headings spacing & weight */
h1, h2, h3, h4, h5, h6 { color: var(--text-primary); font-weight: 700; letter-spacing: -0.02em; }
p, .text-muted, .muted { color: var(--text-secondary) !important; }

/* Footer spacing */
footer { padding-top: 14px; padding-bottom: 14px; }

/* Dashboard card links */
.dashboard-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card-link:hover {
    text-decoration: none;
    color: inherit;
    transform: translateY(-2px);
}

.dashboard-card-link:hover .dashboard-feature-item {
    box-shadow: 0 8px 25px rgba(2,6,23,0.12);
}

/* Dashboard section headers */
.dashboard-section-header {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

/* Dashboard cards grid improvements */
.dashboard-feature-item {
    height: 100%;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.dashboard-feature-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.dashboard-feature-item h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.dashboard-feature-item p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

/* Dashboard card icon colors */
.dashboard-feature-item .orange-color { color: #f97316 !important; }
.dashboard-feature-item .primary-color { color: var(--primary-color) !important; }
.dashboard-feature-item .green-color { color: #10b981 !important; }
.dashboard-feature-item .blue-color { color: #3b82f6 !important; }
.dashboard-feature-item .red-color { color: #ef4444 !important; }

/* Dashboard section spacing */
.dashboard-section {
    margin-bottom: 2rem;
}

.dashboard-section h4 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* Responsive rules */
img, svg, video { max-width: 100%; height: auto; }

@media (max-width: 575.98px) {
  .container, .container-fluid { padding-left: 12px; padding-right: 12px; }
  .btn { width: 100%; }
  .navbar-brand-box img { height: 24px; }
  .page-title, .content-title { font-size: 18px; }
  .breadcrumb { font-size: 13px; }
  
  /* Dashboard cards on mobile */
  .dashboard-feature-item { min-height: 120px; padding: 16px; }
  .dashboard-feature-item h2 { font-size: 1.25rem; }
  .dashboard-feature-item p { font-size: 0.8rem; }
}

@media (max-width: 767.98px) {
  /* Tabs become horizontally scrollable */
  .nav-tabs { overflow-x: auto; overflow-y: hidden; white-space: nowrap; }
  .nav-tabs .nav-link { display: inline-block; }

  /* Tables: horizontal scroll when cramped */
  table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  thead, tbody { width: 100%; }

  /* Modals fit small screens */
  .modal-dialog { max-width: 96%; margin: .5rem auto; }
  .modal-content { max-height: calc(100vh - 1rem); overflow: hidden; display: flex; flex-direction: column; }
  .modal-body { overflow-y: auto; }

  /* Pagination compact */
  .pagination .page-link { padding: 8px 10px; }
}

@media (max-width: 991.98px) {
  /* Sidebar slide in/out and width on mobile */
  .vertical-menu {
    position: fixed; left: 0; top: 0; height: 100vh; z-index: 1030;
    transform: translateX(-100%); transition: transform .25s ease;
    width: 280px; background: var(--surface) !important;
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-enable .vertical-menu { transform: translateX(0); }
  /* Ensure content isn't shifted under fixed sidebar */
  #layout-wrapper { padding-left: 0 !important; }
  /* Overlay already defined below */
}

@media (min-width: 992px) {
  /* Roomier containers on desktop */
  .container, .container-fluid { padding-left: 24px; padding-right: 24px; }
}


/* Adaptive typography and base sizes */
html { font-size: clamp(14px, 1.1vw, 16px); }
body { font-size: clamp(14px, 1.15vw, 16px); line-height: 1.6; }
h1 { font-size: clamp(1.75rem, 2.5vw, 2.25rem); }
h2 { font-size: clamp(1.5rem, 2.2vw, 2rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.75rem); }
h4 { font-size: clamp(1.125rem, 1.8vw, 1.5rem); }
h5 { font-size: clamp(1rem, 1.6vw, 1.25rem); }
h6 { font-size: clamp(0.875rem, 1.4vw, 1.125rem); }

/* Touch-friendly target sizes */
.header-item, .btn, .form-control, .select2-container .select2-selection--single {
  min-height: 44px;
}
.header-item { min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }

/* Performance hints */
.page-content, .main-content, .vertical-menu, .navbar, .card, .modal, .dropdown-menu {
  contain: layout style paint;
  content-visibility: auto;
}

/* Accessibility: reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* Improve hover behavior on touch devices */
@media (hover: none) {
  a:hover { text-decoration: none; }
}

/* Coarse pointer adjustments */
@media (pointer: coarse) {
  .btn, .header-item, .form-control { min-height: 44px; }
}

/* Mobile sidebar overlay for focus and tap to close */
@media (max-width: 991.98px) {
  body.sidebar-enable::before {
    content: '';
    position: fixed; inset: 0; z-index: 1029;
    background: rgba(2,6,23,.35);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
}

