/* 
  Biến CSS 
*/
:root {
  --color-primary: #E4007C;
  --color-primary-hover: #c6006c;
  --color-secondary: #1a1a2e;
  --color-accent: #16213e;
  --color-white: #ffffff;
  --color-bg: #f4f6f9;
  --color-text: #333333;
  --color-text-light: #6c757d;
  --color-border: #e2e8f0;

  /* Status Colors */
  --color-pending: #f59e0b;
  --color-approved: #10b981;
  --color-rejected: #ef4444;
  --color-paid: #3b82f6;

  --border-radius: 8px;
  --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 
  Reset & Normalize 
*/
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

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

/* 
  Typography 
*/
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 0.5rem;
  font-weight: 600;
  line-height: 1.2;
}

/* 
  Layout & Utils
*/
.text-center { text-align: center; }
.text-primary { color: var(--color-primary); }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }

/* 
  Components: Card 
*/
.card {
  background: var(--color-white);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 2rem;
  position: relative; /* For loading overlay */
}

/* 
  Components: Buttons 
*/
.btn {
  display: inline-block;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
  border: 1px solid transparent;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  line-height: 1.5;
  border-radius: var(--border-radius);
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-primary {
  color: var(--color-white);
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.btn-success {
  color: var(--color-white);
  background-color: var(--color-approved);
}

.btn-danger {
  color: var(--color-white);
  background-color: var(--color-rejected);
}

.btn-block {
  display: block;
  width: 100%;
}

/* 
  Components: Forms 
*/
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-white);
  background-clip: padding-box;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
  color: var(--color-text);
  background-color: var(--color-white);
  border-color: var(--color-primary);
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(228, 0, 124, 0.25);
}

/* 
  Auth specific 
*/
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.auth-container .card {
  width: 100%;
  max-width: 450px;
}

/* 
  Spinner & Loading 
*/
.spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  vertical-align: text-bottom;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border .75s linear infinite;
}

@keyframes spinner-border {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  border-radius: var(--border-radius);
}

/* 
  Toasts 
*/
.toast {
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  font-weight: 500;
}

.toast-danger {
  background-color: #fee2e2;
  color: #991b1b;
  border-left: 4px solid var(--color-rejected);
}

/* 
  Navbar 
*/
.navbar {
  background-color: var(--color-secondary);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--color-white);
}
.navbar a { color: var(--color-white); }
.navbar .brand { font-size: 1.5rem; font-weight: bold; color: var(--color-primary); }

/* 
  Dashboard / Layouts 
*/
.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background-color: var(--color-accent);
  color: var(--color-white);
  padding: 2rem 1rem;
}

.sidebar ul {
  list-style: none;
}

.sidebar ul li {
  margin-bottom: 1rem;
}

.sidebar ul li a {
  color: #cbd5e1;
  display: block;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
}
.sidebar ul li a:hover {
  background-color: rgba(255,255,255,0.1);
  color: var(--color-white);
}

.main-content {
  flex-grow: 1;
  padding: 2rem;
}

/* 
  Stat Cards Grid
*/
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--color-white);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  text-align: center;
}

.stat-card h3 {
  color: var(--color-text-light);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--color-primary);
}

/* 
  Tables
*/
.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  background-color: var(--color-white);
}

.table th, .table td {
  padding: 1rem;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.table th {
  font-weight: 600;
  background-color: #f8fafc;
  color: var(--color-text-light);
}

/* 
  Badges 
*/
.badge {
  display: inline-block;
  padding: 0.25em 0.6em;
  font-size: 0.75em;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25rem;
  color: #fff;
}

.badge-pending { background-color: var(--color-pending); }
.badge-approved { background-color: var(--color-approved); }
.badge-rejected { background-color: var(--color-rejected); }
.badge-paid { background-color: var(--color-paid); }

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: var(--color-white);
  padding: 2rem;
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 500px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
}

/* 
  Responsive 
*/
@media (max-width: 768px) {
  .dashboard {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    padding: 1rem;
  }
  .sidebar ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .sidebar ul li { margin-bottom: 0; }
  .main-content { padding: 1rem; }
}
