/* ==================== EDIT MODE INDICATOR ==================== */
.edit-mode-banner {
  background: linear-gradient(135deg, #060300 0%, #d35400 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
  animation: pulse 2s ease-in-out infinite;
}

.edit-mode-banner::before {
  font-size: 24px;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
  }
  50% {
    box-shadow: 0 4px 20px rgba(230, 126, 34, 0.5);
  }
}

.edit-mode-banner strong {
  font-weight: 700;
  font-size: 16px;
}

/* Sidebar disabled state during edit mode */
.sidebar ul li a.disabled-link {
  pointer-events: none !important;
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  filter: grayscale(100%);
}

/* Button styles untuk mode edit */
#kembaliBtn {
  background: #95a5a6;
}

#kembaliBtn:hover {
  background: #7f8c8d;
}

#updateBtn {
  background: #27ae60;
}

#updateBtn:hover {
  background: #229954;
}

/* ==================== RESET & BASE ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
  /* Sidebar Variables */
  --sidebar-width: 260px;
  --sidebar-bg: #0a3d62;
  --sidebar-text: rgba(255, 255, 255, 0.95);
  --sidebar-item-width: 220px;
  --sidebar-item-padding-y: 12px;
  
  /* Indicator Variables */
  --indicator-bg: rgba(173, 216, 230, 0.22);
  --indicator-shadow: 0 6px 16px rgba(26, 115, 168, 0.08);
  --indicator-radius: 10px;
  --indicator-fallback-height: 48px;
  --indicator-gap-top: 6px;
  
  /* Color Palette */
  --primary-blue: #3498db;
  --primary-dark: #2980b9;
  --accent-blue: #0a3d62;
  --accent-hover: #1e6091;
  --text-dark: #2c3e50;
  --text-medium: #34495e;
  --bg-light: #f5f7fa;
  --bg-white: #ffffff;
  --bg-hover: #ecf6fd;
  --bg-even: #f9fbfd;
  --border-light: #eee;
  --border-medium: #ccc;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.1);
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg-light);
  color: #333;
  line-height: 1.6;
  display: flex;
  height: 100vh;      
  overflow: hidden;   
  overflow-x: hidden;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: white;
  min-height: 100vh;
  padding: 24px 16px;
  position: fixed;
  left: 0;
  top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;                 /* agar tinggi memenuhi layar */
  width: var(--sidebar-width, 260px);
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;          /* <- penting: scroll di sini */
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--sidebar-bg, #063a5d);
  z-index: 10;               /* agar di atas content jika perlu */
}

/* Logo Styling */
.sidebar-logo {
  display: block;
  max-width: 180px;
  height: auto;
  margin: 0 auto 30px;
  border-radius: 8px;
}

.sidebar h2 {
  font-size: 18px;
  margin-bottom: 24px;
  color: rgba(255, 255, 255, 0.95);
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* Sidebar Navigation */
.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.sidebar ul li {
  width: 100%;
  margin: 6px 0;
  display: flex;
  justify-content: center;
}

.sidebar ul li a {
  display: flex;                
  justify-content: center;      
  align-items: center;          
  width: var(--sidebar-item-width);
  height: 50px;                 
  margin-bottom: 8px;           
  color: var(--sidebar-text);
  text-decoration: none;
  cursor: pointer;
  border-radius: 10px;
  position: relative;
  z-index: 4;
  transition: color 160ms ease, transform 120ms ease, background 120ms ease;
  box-sizing: border-box;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.sidebar ul li a:hover {
  color: #ffffff;
  transform: translateY(-1px);
}

.sidebar ul li a.selected,
.sidebar ul li.active a {
  color: #ffffff;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Sidebar Indicator */
.sidebar-indicator,
#sidebarIndicator {
  position: absolute;
  width: var(--sidebar-item-width);
  left: calc(50% - (var(--sidebar-item-width) / 2));
  height: var(--indicator-fallback-height);
  top: 0;
  transform: translateY(0);
  background: var(--indicator-bg);
  border-radius: var(--indicator-radius);
  transition: transform 220ms cubic-bezier(0.2, 0.9, 0.3, 1), 
              opacity 200ms ease, 
              box-shadow 220ms ease, 
              height 140ms ease;
  pointer-events: none;
  z-index: 2;
  box-shadow: var(--indicator-shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(4px);
  opacity: 1;
}

.sidebar-indicator.hidden,
#sidebarIndicator.hidden {
  opacity: 0;
}

/* ==================== CONTENT AREA ==================== */
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 30px;
  width: calc(100% - var(--sidebar-width));
  height: 100vh;            
  overflow-y: auto;         
  -webkit-overflow-scrolling: touch; 
  box-sizing: border-box;
}

.content h1,
.content #pageTitle {
  text-align: center;
  margin-bottom: 35px;
  color: var(--text-dark);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ==================== FORM ELEMENTS ==================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--bg-white);
  padding: 35px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

label {
  font-weight: 600;
  display: block;
  margin: 15px 0 8px;
  color: var(--text-medium);
  font-size: 14px;
}

select,
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 15px;
  border: 1.5px solid var(--border-medium);
  border-radius: 8px;
  font-size: 14px;
  transition: border 0.3s ease, box-shadow 0.3s ease;
  background: var(--bg-white);
}

select:focus,
input:focus {
  border: 1.5px solid var(--primary-blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

select:disabled,
input:disabled {
  background-color: #f5f5f5;
  color: #999;
  cursor: not-allowed;
  opacity: 0.65;
}

/* Readonly inputs */
input[readonly] {
  background-color: #f9f9f9;
  cursor: default;
}

/* ==================== BUTTONS ==================== */
button {
  display: inline-block;
  background: var(--primary-blue);
  color: #fff;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2);
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

button:active {
  transform: translateY(0);
}

/* ==================== TABLES ==================== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 25px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--bg-white);
}

table thead {
  background: var(--primary-blue);
  color: #fff;
}

table th {
  padding: 16px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

table td {
  padding: 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  color: var(--text-dark);
}

table tbody tr {
  transition: background 0.2s ease;
}

table tbody tr:hover {
  background: var(--bg-hover);
}

table tbody tr:nth-child(even) {
  background: var(--bg-even);
}

table tbody tr:nth-child(even):hover {
  background: var(--bg-hover);
}

table tfoot {
  background: #ecf0f1;
  font-weight: bold;
}

table tfoot td {
  padding: 16px 14px;
  font-size: 15px;
  border-top: 2px solid var(--border-medium);
}

.total {
  text-align: left;
  font-weight: bold;
  font-size: 20px;
  color: var(--text-dark);
}

.nilai {
  text-align: center;
  font-size: 20px;
  color: var(--text-dark);
  font-weight: bold;
}

/* ==================== TAHUN BOX (Form Header) ==================== */
.tahun-box {
  flex-shrink: 0; 
  max-height: 280px; 
  overflow-y: auto; 
  overflow-x: hidden;
  margin-bottom: 25px;
  padding: 20px 24px;
  background: var(--bg-white);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  border-left: 4px solid var(--accent-blue);
}

.tahun-box > div {
  display: flex;
  flex-direction: column;
}

.tahun-box label {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tahun-box select,
.tahun-box input {
  padding: 10px 12px;
  border: 1.5px solid var(--border-medium);
  border-radius: 6px;
  width: 100%;
  font-size: 14px;
  margin-bottom: 0;
}

.tahun-box button {
  background: var(--accent-blue);
  margin-top: 8px;
  align-self: flex-start;
}

.tahun-box button:hover {
  background: var(--accent-hover);
}

/* ==================== FILTER BOX ==================== */
.filter-box {
  background: var(--bg-white);
  padding: 24px;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
  border-left: 4px solid var(--primary-blue);
}

.filter-box h3 {
  margin: 0 0 20px 0;
  color: var(--text-dark);
  font-size: 18px;
  font-weight: 600;
}

.filter-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-row label {
  font-weight: 600;
  color: var(--text-dark);
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-row select,
.filter-row input {
  padding: 10px 12px;
  border: 1.5px solid var(--border-medium);
  border-radius: 8px;
  font-size: 14px;
  width: 100%;
  max-width: 450px;
  margin-bottom: 0;
}

.filter-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.filter-actions button {
  background: var(--accent-blue);
}

.filter-actions button:hover {
  background: var(--accent-hover);
}

.filter-actions button:last-child {
  background: #95a5a6;
}

.filter-actions button:last-child:hover {
  background: #7f8c8d;
}

/* ==================== INFO HEADER (Resume KPI) ==================== */
.info-header {
  background: linear-gradient(135deg, #e8f4fd 0%, #d4ebf7 100%);
  padding: 20px 24px;
  border-radius: 10px;
  margin-bottom: 25px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  border-left: 4px solid var(--primary-blue);
  box-shadow: var(--shadow-sm);
}

.info-header p {
  margin: 0;
  font-size: 15px;
  color: var(--text-dark);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-header strong {
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-header span {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
}

/* ==================== KPI TABLE ==================== */
.kpi-table {
  width: 100%;
  border-collapse: collapse;
  margin: 25px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.kpi-table thead {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
  color: #fff;
}

.kpi-table th {
  padding: 16px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
}

.kpi-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.2s ease;
}

/* Warna transparan berbeda untuk setiap periode Q */
.kpi-table tbody tr.periode-q1 {
  background: rgba(52, 152, 219, 0.08);
}

.kpi-table tbody tr.periode-q1:hover {
  background: rgba(52, 152, 219, 0.15);
}

.kpi-table tbody tr.periode-q2 {
  background: rgba(46, 204, 113, 0.08);
}

.kpi-table tbody tr.periode-q2:hover {
  background: rgba(46, 204, 113, 0.15);
}

.kpi-table tbody tr.periode-q3 {
  background: rgba(241, 196, 15, 0.08);
}

.kpi-table tbody tr.periode-q3:hover {
  background: rgba(241, 196, 15, 0.15);
}

.kpi-table tbody tr.periode-q4 {
  background: rgba(155, 89, 182, 0.08);
}

.kpi-table tbody tr.periode-q4:hover {
  background: rgba(155, 89, 182, 0.15);
}

.kpi-table td {
  padding: 14px;
  font-size: 14px;
  color: var(--text-dark);
}

.kpi-table tfoot {
  background: #ecf0f1;
  font-weight: 700;
}

.kpi-table tfoot td {
  padding: 16px 14px;
  font-size: 15px;
}

.kpi-table .total-row {
  background: linear-gradient(135deg, #d5dbdb 0%, #c8d1d3 100%);
}

.kpi-table .total-row td {
  color: var(--text-dark);
  font-weight: 700;
}

.kpi-table .kpi-row {
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.kpi-table .kpi-row td {
  color: white;
  font-size: 16px;
  font-weight: 700;
}

/* ==================== ACTION BUTTONS ==================== */
.action-btn {
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 6px;
  transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  display: inline-block;
  border: none;
}

.action-btn-edit {
  background-color: #3498db;
  color: white;
  border: 2px solid #2980b9;
  box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2);
  border-radius: 8px; 
  padding: 5px 15px; 
  cursor: pointer;
}

.action-btn-edit:hover {
  background-color: #2980b9;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
  transform: translateY(-2px);
}


.action-btn-hapus {
  background-color: #fa4632c0;
  color: white;
  border: 2px solid #ff7d6f;
  box-shadow: 0 2px 6px rgba(231, 76, 60, 0.2);
  border-radius: 8px; 
  padding: 5px 15px; 
  cursor: pointer;
  
}

.action-btn-hapus:hover {
  background-color: #c0392b;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
  transform: translateY(-2px);
}


/* ==================== UTILITY CLASSES ==================== */
.hidden {
  display: none !important;
}

.total-box {
  background: linear-gradient(135deg, #ecf0f1 0%, #dfe6e9 100%);
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  margin-top: 25px;
  font-size: 22px;
  font-weight: bold;
  color: var(--text-dark);
  box-shadow: var(--shadow-sm);
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
    --sidebar-item-width: 200px;
  }
  
  .content {
    padding: 24px;
  }
}

@media (max-width: 768px) {
  body {
    height: auto;
    overflow: auto; /* kembali ke scroll normal di mobile */
  }
  .content {
    height: auto;
    overflow: visible;
  }
} 

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    min-height: auto;
    position: relative;
    padding: 16px;
  }
  
  .content {
    margin-left: 0;
    width: 100%;
    padding: 20px;
  }
  
  .tahun-box {
    grid-template-columns: 1fr;
  }
  
  .info-header {
    grid-template-columns: 1fr;
  }
  
  .filter-row select,
  .filter-row input {
    max-width: 100%;
  }
  
  table {
    font-size: 13px;
  }
  
  table th,
  table td {
    padding: 10px 8px;
  }
}

@media (max-width: 520px) {
  :root {
    --sidebar-item-width: 180px;
  }
  
  .content h1,
  .content #pageTitle {
    font-size: 24px;
  }
  
  .container {
    padding: 20px;
  }
  
  button {
    width: 100%;
    margin-bottom: 8px;
  }
  
  .filter-actions {
    flex-direction: column;
  }
  
  .filter-actions button {
    width: 100%;
  }
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .sidebar-indicator,
  #sidebarIndicator {
    transition: none;
    backdrop-filter: none;
  }
}

/* Focus styles for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* ==================== SCROLLBAR STYLING ==================== */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ==================== PRINT STYLES ==================== */
@media print {
  .sidebar {
    display: none;
  }
  
  .content {
    margin-left: 0;
    width: 100%;
  }
  
  button,
  .action-btn {
    display: none;
  }
  
  table {
    box-shadow: none;
  }
}

