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

:root {
  --bg-color: #0d1117; /* Very dark blue-gray */
  --bg-gradient: radial-gradient(circle at top left, #161b22, #0d1117 70%);
  --glass-bg: rgba(22, 27, 34, 0.45);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  
  --primary-color: #00e5ff; /* Cyan accent */
  --primary-hover: #00b3cc;
  --secondary-color: #7b2cbf; /* Purple secondary accent */
  --danger-color: #fca311;
  --success-color: #00f5a0;
  
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  
  --border-radius: 16px;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Base Glassmorphism Class */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  box-shadow: var(--glass-shadow);
  transition: var(--transition);
}

.glass-panel:hover {
  border-color: var(--glass-border-hover);
}

/* ================== LOGIN PAGE ================== */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  position: relative;
  z-index: 10;
}

/* Ambient glow blobs behind the login card */
.ambient-glow-1, .ambient-glow-2 {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  z-index: 0;
  animation: float 10s infinite ease-in-out;
}

.ambient-glow-1 {
  background: var(--primary-color);
  width: 400px;
  height: 400px;
  top: 10%;
  left: 20%;
}

.ambient-glow-2 {
  background: var(--secondary-color);
  width: 350px;
  height: 350px;
  bottom: 10%;
  right: 20%;
  animation-delay: -5s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.1); }
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  text-align: center;
  position: relative;
  z-index: 10;
  animation: slideUp 0.6s ease-out forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-header p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 30px;
}

.form-group {
  text-align: left;
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 15px;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary-color);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary-color), #007bb5);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 10px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 229, 255, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ================== DASHBOARD LAYOUT ================== */
.dashboard-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  height: 100%;
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  z-index: 20;
}

.brand {
  padding: 0 24px;
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: bold;
  color: #000;
}

.nav-menu {
  list-style: none;
  flex-grow: 1;
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.nav-link i {
  font-size: 18px;
}

.nav-link:hover, .nav-item.active .nav-link {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.nav-item.active .nav-link {
  border-left-color: var(--primary-color);
  background: linear-gradient(90deg, rgba(0,229,255,0.1) 0%, transparent 100%);
}

/* Collapsible Submenu */
.has-submenu .submenu-toggle {
  justify-content: flex-start;
  position: relative;
}

.submenu-arrow {
  margin-left: auto;
  transition: transform 0.3s ease;
  font-size: 16px;
}

.has-submenu.open .submenu-arrow {
  transform: rotate(180deg);
}

.submenu {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.3s ease;
  opacity: 0;
}

.has-submenu.open .submenu {
  max-height: 300px;
  opacity: 1;
}

.nav-sub-item {
  margin-bottom: 2px;
}

.nav-sub-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px 10px 44px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.nav-sub-link i {
  font-size: 15px;
}

.nav-sub-link:hover {
  color: var(--text-main);
  background: rgba(255,255,255,0.03);
}

.nav-sub-item.active .nav-sub-link {
  color: var(--primary-color);
  border-left-color: var(--primary-color);
  background: linear-gradient(90deg, rgba(0,229,255,0.06) 0%, transparent 100%);
}

/* Request table: blue header */
.request-table thead th {
  background: linear-gradient(135deg, #1a4b8c, #143d73);
  color: #b3d4fc;
}

/* QC table: teal header */
.qc-table thead th {
  background: linear-gradient(135deg, #0d6868, #0a5252);
  color: #b2dfdb;
}

.sidebar-footer {
  padding: 0 24px;
  margin-top: auto;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--secondary-color);
  display: grid;
  place-items: center;
  font-weight: 600;
  color: #fff;
}

.user-info h6 {
  font-size: 14px;
  margin: 0;
  font-weight: 600;
}

.user-info p {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}

/* Main Content Area */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Fancy background for dashboard */
.dash-bg-blob {
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(123, 44, 191, 0.15) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  z-index: 0;
  pointer-events: none;
}

.topbar {
  height: 70px;
  padding: 0 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(13, 17, 23, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
}

.page-title h1 {
  font-size: 22px;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.action-btn:hover {
  color: var(--text-main);
}

.badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: var(--danger-color);
  color: #000;
  font-size: 10px;
  font-weight: bold;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.main-content {
  padding: 30px;
  overflow-y: auto;
  z-index: 10;
  flex-grow: 1;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--glass-border-hover);
}

/* Dashboard Grid & Widgets */
.kpi-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.kpi-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(0, 229, 255, 0.1);
  color: var(--primary-color);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.kpi-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-main);
}

.kpi-trend {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-trend.positive { color: var(--success-color); }
.kpi-trend.negative { color: #ff4d4d; }

/* Charts Layout based on Excel structure */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.chart-widget {
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.chart-widget.full-width {
  grid-column: span 2;
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.widget-title {
  font-size: 16px;
  font-weight: 600;
}

.widget-actions button {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.widget-actions button:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-main);
}

.chart-container {
  flex-grow: 1;
  position: relative;
  min-height: 250px;
  width: 100%;
}

/* Status Badges similar to Excel */
.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
}
.status-good {
  color: var(--success-color);
  border-color: var(--success-color);
  background: rgba(0, 245, 160, 0.1);
}

/* Responsiveness */
@media (max-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  .chart-widget.full-width { grid-column: span 1; }
}

@media (max-width: 768px) {
  .dashboard-layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    padding: 16px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .brand { margin-bottom: 0; padding: 0; }
  .nav-menu { display: none; }
  .sidebar-footer { display: none; }
  .main-content { padding: 16px; }
}

/* ================== DATA TABLES ================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--glass-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

/* Produksi table: green header */
.produksi-table thead th {
  background: linear-gradient(135deg, #0d6832, #0a522a);
  color: #c6efce;
}

/* Maintenance table: amber/yellow header */
.maintenance-table thead th {
  background: linear-gradient(135deg, #b8860b, #996515);
  color: #fff8dc;
}

.data-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(255,255,255,0.04);
}

.data-table tbody td {
  padding: 12px 16px;
  color: var(--text-main);
  white-space: nowrap;
}

.table-action-btn {
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.2);
  color: var(--primary-color);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
}

.table-action-btn:hover {
  background: rgba(0, 229, 255, 0.2);
  transform: scale(1.05);
}

/* ================== STATUS PILLS ================== */
.status-pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}

.status-open {
  background: rgba(252, 163, 17, 0.15);
  color: #fca311;
  border: 1px solid rgba(252, 163, 17, 0.3);
}

.status-progress {
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.status-closed {
  background: rgba(0, 245, 160, 0.15);
  color: #00f5a0;
  border: 1px solid rgba(0, 245, 160, 0.3);
}

/* ================== MODAL ================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  width: 90%;
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  animation: slideUp 0.3s ease forwards;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}

.modal-close:hover {
  color: #ff4d4d;
  transform: scale(1.2);
}

.modal-form .form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 4px;
}

.modal-form .form-row .form-group {
  flex: 1;
}

.modal-form .form-group {
  margin-bottom: 16px;
}

.modal-form .form-group label {
  font-size: 12px;
  margin-bottom: 6px;
}

.modal-form .form-control {
  padding: 10px 14px;
  font-size: 14px;
}

/* Select styling */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b949e' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

select.form-control option {
  background: #161b22;
  color: var(--text-main);
}
