/* ============================================================
   APLIKASI REKAP BELANJA CV - BIRU TOSKA MODERN THEME
   Dominan Biru Toska (#0d9488 / #0f766e / #14b8a6 / #06b6d4)
   ============================================================ */

:root {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #14b8a6;
  --primary-subtle: #f0fdfa;
  --primary-border: #99f6e4;
  --sidebar-bg: #0f766e;
  --bg-main: #f8fafc;
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --card-shadow: 0 4px 12px rgba(15, 118, 110, 0.06);
  --card-shadow-hover: 0 8px 20px rgba(15, 118, 110, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Typography & Links */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

/* App Shell Layout */
.app-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Styling */
.app-sidebar {
  width: 270px;
  background-color: var(--sidebar-bg);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
  z-index: 1030;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.brand-text h5 {
  color: #fff;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.brand-text small {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-menu {
  list-style: none;
  padding: 1.25rem 0.85rem;
  margin: 0;
  flex: 1;
}

.menu-category {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.55);
  padding: 0.75rem 0.85rem 0.4rem;
  font-weight: 700;
}

.menu-item {
  margin-bottom: 4px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.92rem;
  transition: all 0.2s ease;
  position: relative;
}

.menu-link i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  opacity: 0.9;
}

.menu-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  transform: translateX(4px);
}

.menu-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.22);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.menu-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 4px;
  background: #5eead4;
  border-radius: 0 4px 4px 0;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #14b8a6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Main Content Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-main);
}

/* Header Navbar */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.sidebar-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
}

.sidebar-toggle-btn:hover {
  background: var(--primary-subtle);
  color: var(--primary);
}

/* Header Dropdown Search */
.quick-search-box {
  position: relative;
  width: 320px;
}

.quick-search-box input {
  padding-left: 2.5rem;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  font-size: 0.88rem;
  background: #f8fafc;
  transition: all 0.2s ease;
}

.quick-search-box input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.quick-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.quick-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1050;
  display: none;
}

.quick-search-results a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-main);
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.88rem;
}

.quick-search-results a:last-child {
  border-bottom: none;
}

.quick-search-results a:hover {
  background: var(--primary-subtle);
  color: var(--primary);
}

/* Page Body */
.app-content {
  padding: 1.5rem;
  flex: 1;
}

/* Cards */
.card-custom {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  transition: all 0.25s ease;
  margin-bottom: 1.5rem;
}

.card-custom:hover {
  box-shadow: var(--card-shadow-hover);
}

.card-header-custom {
  background: transparent;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card-header-custom h5 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
}

/* Stat Cards (Dashboard) */
.stat-card {
  padding: 1.35rem;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background-color: var(--primary);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  background-color: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.stat-info h3 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
}

.stat-info p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Custom Fieldset Grouping (Sesuai README) */
.custom-fieldset {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem 1.5rem;
  margin-bottom: 1.5rem;
  background: #ffffff;
  position: relative;
  transition: border-color 0.2s ease;
}

.custom-fieldset:focus-within {
  border-color: var(--primary);
}

.custom-fieldset legend {
  float: none;
  width: auto;
  padding: 4px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  border-radius: 20px;
  margin-bottom: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Form Controls & Labels */
.form-label {
  font-weight: 600;
  font-size: 0.86rem;
  color: #334155;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-control, .form-select {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  color: var(--text-main);
  background-color: #ffffff;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
  outline: none;
}

/* Buttons */
.btn {
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-teal {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.2);
}

.btn-teal:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.3);
  transform: translateY(-1px);
}

.btn-outline-teal {
  border: 1.5px solid var(--primary);
  color: var(--primary);
  background: transparent;
}

.btn-outline-teal:hover {
  background: var(--primary-subtle);
  color: var(--primary-hover);
}

/* Tables & DataTables Styling */
.table-responsive {
  border-radius: var(--radius-sm);
}

.table-custom {
  width: 100% !important;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.table-custom thead th {
  background-color: #f1f5f9;
  color: #334155;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.table-custom tbody td {
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}

.table-custom tbody tr:hover {
  background-color: #f8fafc;
}

/* Badges */
.badge-custom {
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.76rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-active { background: #d1fae5; color: #047857; }
.badge-inactive { background: #fee2e2; color: #b91c1c; }
.badge-admin { background: #ede9fe; color: #6d28d9; }
.badge-user { background: #e0f2fe; color: #0369a1; }

/* Currency formatting badge / tag */
.curr-deal { color: #0f766e; font-weight: 700; }
.curr-kulakan { color: #d97706; font-weight: 700; }
.curr-dapur { color: #4338ca; font-weight: 700; }
.curr-penawaran { color: #e11d48; font-weight: 700; }

/* Autocomplete suggestion dropdown */
.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1060;
  background: #ffffff;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.15s ease;
}

.autocomplete-item:hover, .autocomplete-item.active {
  background: var(--primary-subtle);
  color: var(--primary-hover);
  font-weight: 600;
}

/* Modals */
.modal-content {
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
  background: #f8fafc;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h5 {
  font-size: 1.15rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Tooltip custom */
.tooltip-inner {
  background-color: #0f172a;
  border-radius: 6px;
  font-size: 0.8rem;
  padding: 6px 10px;
}

/* Print View Specific */
@media print {
  .app-sidebar, .app-header, .btn, .no-print, .dataTables_filter, .dataTables_length, .dataTables_paginate, .dataTables_info {
    display: none !important;
  }
  .app-main, .app-wrapper, .app-content {
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
  }
  .card-custom {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}

/* Responsive Breakpoints */
@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    left: -270px;
    top: 0;
    bottom: 0;
    z-index: 1050;
  }
  .app-sidebar.show {
    left: 0;
  }
  .sidebar-toggle-btn {
    display: inline-flex;
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1040;
    display: none;
  }
  .sidebar-backdrop.show {
    display: block;
  }
  .quick-search-box {
    width: 200px;
  }
}

@media (max-width: 575.98px) {
  .app-content {
    padding: 1rem;
  }
  .quick-search-box {
    display: none;
  }
  .card-header-custom {
    padding: 1rem;
  }
}

/* Teal Utility Colors */
.text-teal {
  color: #0d9488 !important;
}

.bg-teal {
  background-color: #0d9488 !important;
  color: #ffffff !important;
}

.bg-teal-subtle {
  background-color: #f0fdfa !important;
  color: #0f766e !important;
  border: 1px solid #99f6e4 !important;
}

.border-teal {
  border-color: #0d9488 !important;
}
