/* ============================================================
   DRACPL ERP - Main Stylesheet
   Professional ERP Design | v1.0.0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&family=Playfair+Display:wght@600&display=swap');

:root {
  --brand-primary:   #1a3c6e;
  --brand-dark:      #0f2447;
  --brand-accent:    #e8a020;
  --brand-light:     #e8f0fb;
  --brand-green:     #1a7a4a;
  --brand-red:       #c0392b;
  --brand-orange:    #d35400;

  --bg-page:         #f0f2f7;
  --bg-card:         #ffffff;
  --bg-sidebar:      #0f2447;
  --bg-sidebar-hover:#1a3c6e;
  --bg-header:       #ffffff;

  --text-primary:    #1a1f36;
  --text-secondary:  #5a6585;
  --text-muted:      #8c95b0;
  --text-white:      #ffffff;
  --text-sidebar:    #c8d4ea;
  --text-sidebar-active: #ffffff;

  --border-color:    #dce3f0;
  --border-light:    #eef1f8;

  --shadow-sm:       0 1px 3px rgba(26,60,110,0.08);
  --shadow-md:       0 4px 16px rgba(26,60,110,0.12);
  --shadow-lg:       0 8px 32px rgba(26,60,110,0.16);

  --sidebar-w:       260px;
  --header-h:        60px;
  --radius-sm:       6px;
  --radius-md:       10px;
  --radius-lg:       16px;

  --font-main:       'DM Sans', sans-serif;
  --font-mono:       'DM Mono', monospace;
  --font-display:    'Playfair Display', serif;

  --transition:      all 0.2s ease;
}

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

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-main);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- LAYOUT ---- */
.erp-wrapper { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: #1a3c6e transparent;
  transition: var(--transition);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #1a3c6e; border-radius: 4px; }

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo img { height: 36px; }

.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  color: #fff;
  letter-spacing: 0.3px;
}

.sidebar-logo-text span {
  display: block;
  font-family: var(--font-main);
  font-size: 10px;
  font-weight: 400;
  color: var(--text-sidebar);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-user {
  padding: 14px 20px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-name { font-size: 13px; font-weight: 500; color: #fff; }
.sidebar-user-role { font-size: 11px; color: var(--text-sidebar); text-transform: capitalize; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(200,212,234,0.5);
  padding: 14px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  border-left: 3px solid transparent;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  border-left-color: rgba(232,160,32,0.5);
}

.nav-item.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-left-color: var(--brand-accent);
  font-weight: 500;
}

.nav-item .nav-icon {
  width: 18px; height: 18px;
  opacity: 0.7;
  flex-shrink: 0;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--brand-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.nav-item-locked { opacity: 0.4; pointer-events: none; }

.sidebar-bottom {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-bottom a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-sidebar);
  font-size: 12.5px;
  text-decoration: none;
  padding: 6px 0;
  transition: var(--transition);
}

.sidebar-bottom a:hover { color: #fff; }

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- HEADER ---- */
.erp-header {
  height: var(--header-h);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.header-breadcrumb .current {
  color: var(--text-primary);
  font-weight: 500;
}

.header-search {
  display: flex;
  align-items: center;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  gap: 8px;
  width: 240px;
}

.header-search input {
  border: none;
  background: none;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  cursor: pointer;
  color: var(--text-secondary);
  position: relative;
  transition: var(--transition);
}

.header-btn:hover { background: var(--brand-light); color: var(--brand-primary); }

.header-notif-count {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--brand-red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fy-badge {
  background: var(--brand-light);
  color: var(--brand-primary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(26,60,110,0.15);
}

/* ---- PAGE CONTENT ---- */
.page-content { padding: 24px; flex: 1; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.page-title { font-size: 20px; font-weight: 600; color: var(--text-primary); }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ---- CARDS ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.card-body  { padding: 20px; }

/* ---- STAT CARDS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green  { background: #dcfce7; color: #15803d; }
.stat-icon.orange { background: #fef3c7; color: #b45309; }
.stat-icon.red    { background: #fee2e2; color: #b91c1c; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.teal   { background: #ccfbf1; color: #0f766e; }

.stat-value { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.stat-change { font-size: 11px; margin-top: 4px; }
.stat-change.up   { color: var(--brand-green); }
.stat-change.down { color: var(--brand-red); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-main);
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary   { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-success   { background: var(--brand-green); color: #fff; }
.btn-success:hover { background: #155d38; }
.btn-danger    { background: var(--brand-red); color: #fff; }
.btn-warning   { background: var(--brand-accent); color: #fff; }
.btn-secondary { background: var(--bg-page); color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--border-light); }
.btn-outline   { background: transparent; color: var(--brand-primary); border: 1px solid var(--brand-primary); }
.btn-outline:hover { background: var(--brand-light); }
.btn-sm        { padding: 5px 10px; font-size: 12px; }
.btn-lg        { padding: 11px 22px; font-size: 14px; }
.btn-icon      { padding: 7px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-label .required { color: var(--brand-red); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-main);
  color: var(--text-primary);
  background: #fff;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(26,60,110,0.08);
}

.form-control:read-only { background: var(--bg-page); color: var(--text-secondary); }

select.form-control { cursor: pointer; }

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.form-row {
  display: grid;
  gap: 16px;
  margin-bottom: 0;
}

.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; }

table.erp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.erp-table th {
  background: var(--bg-page);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.erp-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.erp-table tr:last-child td { border-bottom: none; }

.erp-table tr:hover td { background: rgba(26,60,110,0.02); }

.erp-table td.amount { font-family: var(--font-mono); text-align: right; }
.erp-table th.amount { text-align: right; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-success  { background: #dcfce7; color: #15803d; }
.badge-danger   { background: #fee2e2; color: #b91c1c; }
.badge-warning  { background: #fef3c7; color: #b45309; }
.badge-info     { background: #dbeafe; color: #1d4ed8; }
.badge-neutral  { background: var(--bg-page); color: var(--text-secondary); }
.badge-purple   { background: #ede9fe; color: #7c3aed; }
.badge-orange   { background: #ffedd5; color: #c2410c; }

/* ---- TABS ---- */
.erp-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
  gap: 0;
}

.erp-tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  text-decoration: none;
}

.erp-tab:hover { color: var(--brand-primary); }
.erp-tab.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }

/* ---- ALERTS ---- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ---- UPLOAD ZONE ---- */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--brand-primary);
  background: var(--brand-light);
}

.upload-zone .upload-icon { font-size: 36px; margin-bottom: 10px; }
.upload-zone p { font-size: 13px; color: var(--text-secondary); }
.upload-zone strong { color: var(--brand-primary); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,36,71,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(-10px); } }

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 15px; font-weight: 600; }
.modal-body  { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; gap: 10px; justify-content: flex-end; }

/* ---- LOADING ---- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-row.cols-2, .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ---- PRINT ---- */
@media print {
  .sidebar, .erp-header, .page-header .btn, .header-actions { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
}

/* ---- UTILITY ---- */
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--brand-green); }
.text-danger  { color: var(--brand-red); }
.text-warning { color: var(--brand-accent); }
.text-primary { color: var(--brand-primary); }
.fw-600       { font-weight: 600; }
.fw-500       { font-weight: 500; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
