/* =========================================================
   CENTRAX-FLOW | GLOBAL UI STYLES
   File: /public/assets/css/style.css
   ========================================================= */

/* -----------------------------
   Google Font
----------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

/* -----------------------------
   Root
----------------------------- */
:root{
  --bg:#0b1220;
  --bg-soft:#111827;
  --panel:#0f172a;
  --panel-2:#1e293b;
  --card:#ffffff;
  --card-soft:#f8fafc;
  --line:#e2e8f0;
  --line-dark:#334155;

  --text:#0f172a;
  --text-soft:#475569;
  --text-muted:#64748b;
  --text-light:#cbd5e1;
  --text-white:#ffffff;

  --primary:#2563eb;
  --primary-dark:#1d4ed8;
  --primary-soft:rgba(37,99,235,.10);

  --success:#16a34a;
  --success-soft:rgba(22,163,74,.10);

  --warning:#d97706;
  --warning-soft:rgba(217,119,6,.10);

  --danger:#dc2626;
  --danger-soft:rgba(220,38,38,.10);

  --info:#0891b2;
  --info-soft:rgba(8,145,178,.10);

  --shadow-sm:0 2px 8px rgba(15,23,42,.06);
  --shadow-md:0 8px 24px rgba(15,23,42,.10);
  --shadow-lg:0 18px 40px rgba(15,23,42,.14);

  --radius-sm:10px;
  --radius-md:14px;
  --radius-lg:18px;

  --sidebar-w:260px;
  --container-w:1400px;
}

/* -----------------------------
   Reset
----------------------------- */
*,
*::before,
*::after{
  box-sizing:border-box;
}

html{
  scroll-behavior:smooth;
}

body{
  margin:0;
  padding:0;
  font-family:'Montserrat', sans-serif;
  background:linear-gradient(180deg,#f8fafc 0%, #eef2f7 100%);
  color:var(--text);
  min-height:100vh;
  line-height:1.5;
}

img{
  max-width:100%;
  height:auto;
  display:block;
}

a{
  color:var(--primary);
  text-decoration:none;
  transition:.18s ease;
}

a:hover{
  color:var(--primary-dark);
}

button,
input,
select,
textarea{
  font:inherit;
}

/* -----------------------------
   IMPORTANT: Font Awesome Protection
----------------------------- */
.fa-solid,
.fa-regular,
.fa-brands,
.fa,
.fas,
.far,
.fab{
  font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  line-height: 1;
}

.fa-brands,
.fab{
  font-family: "Font Awesome 6 Brands" !important;
}

.fa-solid,
.fa,
.fas,
.fa-regular,
.far{
  font-weight: 900;
}

/* -----------------------------
   Layout
----------------------------- */
.page-wrap{
  width:100%;
  max-width:var(--container-w);
  margin:0 auto;
  padding:24px;
}

.content{
  padding:24px;
  min-height:100vh;
}

.main-content{
  padding:24px;
}

.section{
  margin-bottom:24px;
}

.section:last-child{
  margin-bottom:0;
}

/* -----------------------------
   Page Header
----------------------------- */
.page-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:24px;
  flex-wrap:wrap;
}

.page-title-wrap{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.page-title{
  margin:0;
  font-size:28px;
  font-weight:800;
  letter-spacing:-.02em;
  color:var(--text);
}

.page-subtitle{
  margin:0;
  font-size:14px;
  color:var(--text-muted);
  font-weight:500;
}

.page-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

/* -----------------------------
   Cards
----------------------------- */
.card{
  background:var(--card);
  border:1px solid rgba(148,163,184,.18);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-sm);
  overflow:hidden;
}

.card + .card{
  margin-top:18px;
}

.card-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:18px 20px;
  border-bottom:1px solid var(--line);
  background:linear-gradient(180deg,#fff 0%, #f8fafc 100%);
}

.card-title{
  margin:0;
  font-size:18px;
  font-weight:700;
  color:var(--text);
}

.card-subtitle{
  margin:4px 0 0;
  font-size:13px;
  color:var(--text-muted);
  font-weight:500;
}

.card-body{
  padding:20px;
}

.card-footer{
  padding:16px 20px;
  border-top:1px solid var(--line);
  background:#fcfdff;
}

/* -----------------------------
   Stat Cards
----------------------------- */
.stats-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:16px;
}

.stat-card{
  background:var(--card);
  border:1px solid rgba(148,163,184,.18);
  border-radius:18px;
  box-shadow:var(--shadow-sm);
  padding:18px;
}

.stat-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.stat-label{
  font-size:13px;
  font-weight:600;
  color:var(--text-muted);
}

.stat-icon{
  width:42px;
  height:42px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--primary-soft);
  color:var(--primary);
  font-size:18px;
}

.stat-value{
  margin-top:12px;
  font-size:28px;
  font-weight:800;
  color:var(--text);
  line-height:1.1;
}

.stat-note{
  margin-top:6px;
  font-size:12px;
  color:var(--text-muted);
}

/* -----------------------------
   Buttons
----------------------------- */
.btn,
button.btn{
  appearance:none;
  border:none;
  outline:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:42px;
  padding:10px 16px;
  border-radius:12px;
  font-weight:700;
  font-size:14px;
  cursor:pointer;
  transition:.18s ease;
  text-decoration:none;
  white-space:nowrap;
}

.btn i{
  font-size:13px;
}

.btn-primary{
  background:var(--primary);
  color:#fff;
  box-shadow:0 10px 20px rgba(37,99,235,.18);
}

.btn-primary:hover{
  background:var(--primary-dark);
  color:#fff;
  transform:translateY(-1px);
}

.btn-secondary{
  background:#e2e8f0;
  color:var(--text);
}

.btn-secondary:hover{
  background:#cbd5e1;
  color:var(--text);
}

.btn-success{
  background:var(--success);
  color:#fff;
}

.btn-success:hover{
  background:#15803d;
  color:#fff;
}

.btn-danger{
  background:var(--danger);
  color:#fff;
}

.btn-danger:hover{
  background:#b91c1c;
  color:#fff;
}

.btn-warning{
  background:var(--warning);
  color:#fff;
}

.btn-warning:hover{
  background:#b45309;
  color:#fff;
}

.btn-outline{
  background:#fff;
  border:1px solid var(--line);
  color:var(--text);
}

.btn-outline:hover{
  background:#f8fafc;
  color:var(--text);
}

.btn-ghost{
  background:transparent;
  border:1px solid transparent;
  color:var(--text-muted);
}

.btn-ghost:hover{
  background:#f1f5f9;
  color:var(--text);
}

.btn-sm{
  min-height:34px;
  padding:7px 12px;
  border-radius:10px;
  font-size:12px;
}

.btn-lg{
  min-height:48px;
  padding:12px 18px;
  border-radius:14px;
}

.btn-block{
  width:100%;
}

.btn:disabled,
button:disabled{
  opacity:.55;
  cursor:not-allowed;
  transform:none !important;
}

/* -----------------------------
   Badges
----------------------------- */
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  line-height:1;
}

.badge-primary{
  background:var(--primary-soft);
  color:var(--primary);
}

.badge-success{
  background:var(--success-soft);
  color:var(--success);
}

.badge-warning{
  background:var(--warning-soft);
  color:var(--warning);
}

.badge-danger{
  background:var(--danger-soft);
  color:var(--danger);
}

.badge-info{
  background:var(--info-soft);
  color:var(--info);
}

.badge-muted{
  background:#f1f5f9;
  color:#475569;
}

/* -----------------------------
   Forms
----------------------------- */
.form-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
}

.form-grid-3{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:16px;
}

.form-group{
  display:flex;
  flex-direction:column;
  gap:7px;
}

.form-group.full{
  grid-column:1 / -1;
}

label,
.form-label{
  font-size:13px;
  font-weight:700;
  color:var(--text-soft);
}

.input,
.select,
.textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
select,
textarea{
  width:100%;
  min-height:44px;
  padding:11px 14px;
  border:1px solid #cbd5e1;
  border-radius:12px;
  background:#fff;
  color:var(--text);
  outline:none;
  transition:.18s ease;
  box-shadow:none;
}

textarea,
.textarea{
  min-height:120px;
  resize:vertical;
}

.input:focus,
.select:focus,
.textarea:focus,
input:focus,
select:focus,
textarea:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 4px rgba(37,99,235,.12);
}

.form-help{
  font-size:12px;
  color:var(--text-muted);
}

.form-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-top:8px;
}

/* -----------------------------
   Search / Filters
----------------------------- */
.toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
  margin-bottom:18px;
}

.toolbar-left,
.toolbar-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.search-box{
  position:relative;
  min-width:260px;
}

.search-box input{
  padding-left:42px;
}

.search-box i{
  position:absolute;
  left:14px;
  top:50%;
  transform:translateY(-50%);
  color:var(--text-muted);
  font-size:14px;
}

.filter-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom:18px;
}

/* -----------------------------
   Tables
----------------------------- */
.table-wrap{
  width:100%;
  overflow:auto;
  border-radius:16px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow:var(--shadow-sm);
}

.table{
  width:100%;
  min-width:900px;
  border-collapse:separate;
  border-spacing:0;
}

.table thead th{
  background:#f8fafc;
  color:var(--text-soft);
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
  padding:14px 14px;
  border-bottom:1px solid var(--line);
  text-align:left;
  white-space:nowrap;
}

.table tbody td{
  padding:14px;
  border-bottom:1px solid #edf2f7;
  font-size:14px;
  color:var(--text);
  vertical-align:middle;
}

.table tbody tr:hover{
  background:#f8fbff;
}

.table tbody tr:last-child td{
  border-bottom:none;
}

.table-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.empty-state{
  padding:36px 20px;
  text-align:center;
  color:var(--text-muted);
}

.empty-state i{
  font-size:34px;
  color:#94a3b8;
  margin-bottom:10px;
}

.empty-title{
  margin:0 0 6px;
  font-size:18px;
  font-weight:800;
  color:var(--text);
}

.empty-text{
  margin:0;
  font-size:14px;
  color:var(--text-muted);
}

/* -----------------------------
   Alerts
----------------------------- */
.alert{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:14px 16px;
  border-radius:14px;
  margin-bottom:16px;
  border:1px solid transparent;
  font-size:14px;
  font-weight:600;
}

.alert i{
  margin-top:2px;
}

.alert-success{
  background:var(--success-soft);
  color:var(--success);
  border-color:rgba(22,163,74,.16);
}

.alert-danger{
  background:var(--danger-soft);
  color:var(--danger);
  border-color:rgba(220,38,38,.16);
}

.alert-warning{
  background:var(--warning-soft);
  color:var(--warning);
  border-color:rgba(217,119,6,.16);
}

.alert-info{
  background:var(--info-soft);
  color:var(--info);
  border-color:rgba(8,145,178,.16);
}

/* -----------------------------
   Modal
----------------------------- */
.modal-overlay{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.55);
  backdrop-filter:blur(4px);
  z-index:5000;
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.modal-overlay.show{
  display:flex;
}

.modal{
  width:min(760px, 100%);
  max-height:90vh;
  overflow:auto;
  background:#fff;
  border-radius:20px;
  box-shadow:var(--shadow-lg);
  border:1px solid rgba(148,163,184,.18);
}

.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:18px 20px;
  border-bottom:1px solid var(--line);
  position:sticky;
  top:0;
  background:#fff;
  z-index:2;
}

.modal-title{
  margin:0;
  font-size:20px;
  font-weight:800;
  color:var(--text);
}

.modal-close{
  width:40px;
  height:40px;
  border:none;
  border-radius:12px;
  background:#f1f5f9;
  color:#334155;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}

.modal-close:hover{
  background:#e2e8f0;
}

.modal-body{
  padding:20px;
}

.modal-footer{
  padding:16px 20px;
  border-top:1px solid var(--line);
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
  background:#fcfdff;
}

/* -----------------------------
   Right Side Drawer Modal
----------------------------- */
.side-modal-overlay{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.45);
  backdrop-filter:blur(2px);
  z-index:5500;
  display:none;
}

.side-modal-overlay.show{
  display:block;
}

.side-modal{
  position:fixed;
  top:0;
  right:0;
  width:min(720px, 100%);
  height:100vh;
  background:#fff;
  box-shadow:-10px 0 30px rgba(15,23,42,.18);
  transform:translateX(100%);
  transition:transform .22s ease;
  z-index:5600;
  display:flex;
  flex-direction:column;
}

.side-modal.show{
  transform:translateX(0);
}

.side-modal-header{
  padding:18px 20px;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.side-modal-title{
  margin:0;
  font-size:20px;
  font-weight:800;
}

.side-modal-body{
  padding:20px;
  overflow:auto;
  flex:1;
}

.side-modal-footer{
  padding:16px 20px;
  border-top:1px solid var(--line);
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}

/* -----------------------------
   Tabs
----------------------------- */
.tabs{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:16px;
}

.tab-btn{
  border:none;
  background:#e2e8f0;
  color:#334155;
  padding:10px 14px;
  border-radius:12px;
  font-weight:700;
  cursor:pointer;
}

.tab-btn.active{
  background:var(--primary);
  color:#fff;
}

.tab-pane{
  display:none;
}

.tab-pane.active{
  display:block;
}

/* -----------------------------
   CRM Top Nav / Finance Nav
----------------------------- */
.finance_navbar{
  width:100%;
  margin:0 0 18px;
  background:#fff;
  border:1px solid rgba(148,163,184,.18);
  border-radius:16px;
  box-shadow:var(--shadow-sm);
  overflow:auto;
}

.finance_nav_links{
  list-style:none;
  margin:0;
  padding:10px;
  display:flex;
  align-items:center;
  gap:10px;
  min-width:max-content;
}

.finance_nav_links li{
  margin:0;
  padding:0;
}

.finance_nav_links li a{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 14px;
  border-radius:12px;
  color:var(--text-soft);
  font-size:13px;
  font-weight:700;
  background:transparent;
  white-space:nowrap;
}

.finance_nav_links li a:hover{
  background:#f1f5f9;
  color:var(--text);
}

/* -----------------------------
   Pagination
----------------------------- */
.pagination{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
  margin-top:18px;
}

.pagination a,
.pagination span{
  min-width:38px;
  height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--text-soft);
  font-size:13px;
  font-weight:700;
  padding:0 10px;
}

.pagination a:hover{
  background:#f8fafc;
}

.pagination .active{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}

/* -----------------------------
   Utilities
----------------------------- */
.grid{
  display:grid;
  gap:16px;
}

.grid-2{
  grid-template-columns:repeat(2,minmax(0,1fr));
}

.grid-3{
  grid-template-columns:repeat(3,minmax(0,1fr));
}

.grid-4{
  grid-template-columns:repeat(4,minmax(0,1fr));
}

.flex{
  display:flex;
}

.flex-wrap{
  flex-wrap:wrap;
}

.items-center{
  align-items:center;
}

.justify-between{
  justify-content:space-between;
}

.gap-8{ gap:8px; }
.gap-10{ gap:10px; }
.gap-12{ gap:12px; }
.gap-16{ gap:16px; }
.gap-20{ gap:20px; }

.mt-0{ margin-top:0; }
.mt-8{ margin-top:8px; }
.mt-10{ margin-top:10px; }
.mt-12{ margin-top:12px; }
.mt-16{ margin-top:16px; }
.mt-20{ margin-top:20px; }
.mt-24{ margin-top:24px; }

.mb-0{ margin-bottom:0; }
.mb-8{ margin-bottom:8px; }
.mb-10{ margin-bottom:10px; }
.mb-12{ margin-bottom:12px; }
.mb-16{ margin-bottom:16px; }
.mb-20{ margin-bottom:20px; }
.mb-24{ margin-bottom:24px; }

.text-center{ text-align:center; }
.text-right{ text-align:right; }

.text-muted{ color:var(--text-muted); }
.text-soft{ color:var(--text-soft); }
.text-primary{ color:var(--primary); }
.text-success{ color:var(--success); }
.text-danger{ color:var(--danger); }
.text-warning{ color:var(--warning); }

.w-100{ width:100%; }

.hidden{
  display:none !important;
}

/* -----------------------------
   Footer
----------------------------- */
.footer{
  padding:18px 24px 26px;
  text-align:center;
  color:var(--text-muted);
  font-size:13px;
}

/* -----------------------------
   Responsive
----------------------------- */
@media (max-width: 1200px){
  .stats-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .grid-4{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width: 992px){
  .page-wrap,
  .content,
  .main-content{
    padding:18px;
  }

  .form-grid,
  .form-grid-3,
  .grid-3,
  .grid-2{
    grid-template-columns:1fr;
  }

  .stats-grid{
    grid-template-columns:1fr;
  }
}

@media (max-width: 768px){
  .page-title{
    font-size:24px;
  }

  .page-header{
    flex-direction:column;
    align-items:stretch;
  }

  .page-actions{
    width:100%;
  }

  .page-actions .btn{
    width:100%;
  }

  .toolbar{
    flex-direction:column;
    align-items:stretch;
  }

  .toolbar-left,
  .toolbar-right{
    width:100%;
  }

  .search-box{
    width:100%;
    min-width:unset;
  }

  .modal,
  .side-modal{
    width:100%;
  }

  .card-body,
  .card-header,
  .card-footer{
    padding:16px;
  }
}

@media (max-width: 520px){
  .page-wrap,
  .content,
  .main-content{
    padding:14px;
  }

  .btn,
  button.btn{
    width:100%;
  }

  .form-actions{
    flex-direction:column;
    align-items:stretch;
  }

  .modal-footer,
  .side-modal-footer{
    flex-direction:column;
    align-items:stretch;
  }

  .modal-footer .btn,
  .side-modal-footer .btn{
    width:100%;
  }
}