/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px; border: none;
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: all .15s ease; white-space: nowrap;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover   { background: var(--accent-hover); }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover   { background: #219a52; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover    { background: #c0392b; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover   { background: #e67e22; }
.btn-secondary { background: #f1f3f4; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e8eaec; }
.btn-outline   { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover   { background: var(--accent); color: #fff; }
.btn-sm  { padding: 5px 10px; font-size: 12.5px; }
.btn-lg  { padding: 11px 22px; font-size: 15px; }
.btn-icon { padding: 7px; border-radius: 6px; line-height: 1; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { margin: 0; font-size: 15px; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: #fafafa; border-radius: 0 0 var(--radius) var(--radius); }

/* Stat cards */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-hover); }
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 12px;
}
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--primary); line-height: 1; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 12.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

.stat-blue   .stat-icon { background: #ebf5fb; color: var(--accent); }
.stat-green  .stat-icon { background: #eafaf1; color: var(--success); }
.stat-yellow .stat-icon { background: #fef9e7; color: var(--warning); }
.stat-red    .stat-icon { background: #fdedec; color: var(--danger); }

/* ── Forms ────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--text); }
.form-control {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: 6px;
  font-size: 13.5px; color: var(--text); background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52,152,219,.15); }
.form-control::placeholder { color: #b2bec3; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.input-group { display: flex; align-items: stretch; }
.input-group-text { padding: 8px 12px; background: #f1f3f4; border: 1.5px solid var(--border); border-right: none; border-radius: 6px 0 0 6px; color: var(--text-muted); font-size: 13px; display: flex; align-items: center; }
.input-group .form-control { border-radius: 0 6px 6px 0; }

/* ── Tables ───────────────────────────────────────────── */
.table-container { overflow-x: auto; }
.table {
  width: 100%; border-collapse: collapse;
}
.table th, .table td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.table th {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .4px; color: var(--text-muted);
  background: #fafafa;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8f9fa; }
.table .actions { display: flex; gap: 6px; }

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
}
.badge-primary { background: #ebf5fb; color: var(--accent); }
.badge-success { background: #eafaf1; color: var(--success); }
.badge-danger  { background: #fdedec; color: var(--danger); }
.badge-warning { background: #fef9e7; color: var(--warning); }
.badge-secondary { background: #f1f3f4; color: var(--text-muted); }
.badge-info    { background: #e8f8f5; color: #17a589; }
.badge-paid    { background: #d5f5e3; color: #1e8449; border: 1px solid #27ae60; font-weight: 700; }

/* ── Progress bar ─────────────────────────────────────── */
.progress { background: #e9ecef; border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 20px; transition: width .4s ease; }
.progress-bar-blue    { background: var(--accent); }
.progress-bar-green   { background: var(--success); }
.progress-bar-red     { background: var(--danger); }
.progress-bar-yellow  { background: var(--warning); }

/* ── Modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .15s ease;
}
.modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .2s ease;
}
.modal-lg { max-width: 880px; }
.modal-sm { max-width: 420px; }
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close {
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--text-muted); line-height: 1; padding: 2px;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: #fafafa; border-radius: 0 0 10px 10px; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ── Toast ────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--primary); color: #fff;
  padding: 12px 18px; border-radius: 8px;
  font-size: 13.5px; max-width: 340px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: slideLeft .2s ease;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-warning { background: var(--warning); }
@keyframes slideLeft { from { transform: translateX(100%); opacity: 0 } to { transform: none; opacity: 1 } }

/* ── Tabs ─────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  background: none; border: none;
  padding: 10px 18px; font-size: 13.5px;
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; font-weight: 500; transition: all .15s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover:not(.active) { color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Grids ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── Page header ──────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h2 { margin: 0; font-size: 20px; }
.page-header-actions { display: flex; gap: 8px; }

/* ── Search/filter bar ─────────────────────────────────── */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar .form-control { width: auto; min-width: 160px; }
.search-input { min-width: 240px !important; }

/* ── Empty state ──────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Alert ────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 6px; font-size: 13.5px; margin-bottom: 16px; border-left: 4px solid; }
.alert-success { background: #eafaf1; border-color: var(--success); color: #196f3d; }
.alert-danger  { background: #fdedec; border-color: var(--danger); color: #922b21; }
.alert-warning { background: #fef9e7; border-color: var(--warning); color: #784212; }
.alert-info    { background: #ebf5fb; border-color: var(--accent); color: #1a5276; }

/* ── Photo gallery ────────────────────────────────────── */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-item {
  border-radius: 8px; overflow: hidden; position: relative;
  aspect-ratio: 1; cursor: pointer;
  border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s;
}
.photo-item:hover { transform: scale(1.02); box-shadow: var(--shadow-hover); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-item .photo-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
  padding: 20px 8px 8px;
  transform: translateY(100%); transition: transform .2s;
}
.photo-item:hover .photo-overlay { transform: none; }
.photo-item .photo-overlay span { color: #fff; font-size: 11px; display: block; }
.photo-item .photo-delete {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,.5); color: #fff; border: none;
  border-radius: 50%; width: 26px; height: 26px; cursor: pointer;
  display: none; align-items: center; justify-content: center; font-size: 14px;
}
.photo-item:hover .photo-delete { display: flex; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.92);
  z-index: 9998; display: flex; align-items: center; justify-content: center;
}
.lightbox img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: 4px; }
.lightbox-close { position: absolute; top: 20px; right: 20px; color: #fff; font-size: 28px; cursor: pointer; background: none; border: none; }

/* ── Calendar ─────────────────────────────────────────── */
.calendar { width: 100%; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.cal-day-header {
  padding: 10px; text-align: center; font-size: 11.5px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-muted); background: #f8f9fa;
  border-right: 1px solid var(--border);
}
.cal-day-header:last-child { border-right: none; }
.cal-cell {
  min-height: 90px; padding: 8px;
  border-right: 1px solid var(--border);
  border-top: 1px solid var(--border);
  background: #fff; position: relative;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.other-month { background: #fafafa; }
.cal-cell.today { background: #ebf5fb; }
.cal-cell.holiday { background: #fef9e7; }
.cal-num { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.cal-cell.today .cal-num { background: var(--accent); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.cal-holiday-label { font-size: 10px; color: var(--warning); font-weight: 600; truncate: ellipsis; overflow: hidden; white-space: nowrap; }
.cal-project-bar {
  display: block; font-size: 10.5px; padding: 2px 6px;
  border-radius: 3px; color: #fff; margin-top: 2px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  cursor: pointer;
}
.cal-bar-blue   { background: var(--accent); }
.cal-bar-green  { background: var(--success); }
.cal-bar-red    { background: var(--danger); }
.cal-bar-yellow { background: var(--warning); }

.cal-cell.cal-critical  { background: #fff8e1; border: 1px solid #f39c12; }
.cal-cell.cal-deadline  { background: #fde8e8; border: 2px solid var(--danger); }
.cal-critical-label {
  font-size: 9px; font-weight: 700; color: #b7770d;
  background: #fff3cd; border-radius: 3px; padding: 0 4px;
  margin-bottom: 2px; text-transform: uppercase; letter-spacing: .3px;
}
.cal-deadline-label {
  font-size: 9px; font-weight: 700; color: #fff;
  background: var(--danger); border-radius: 3px; padding: 0 4px;
  margin-bottom: 2px; text-transform: uppercase; letter-spacing: .3px;
}

/* ── Upload zone ─────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 8px;
  padding: 32px; text-align: center; color: var(--text-muted);
  cursor: pointer; transition: all .2s;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: #ebf5fb; color: var(--accent); }
.upload-zone input[type=file] { display: none; }
.upload-zone .upload-icon { font-size: 36px; margin-bottom: 8px; display: block; }

/* ── Misc ─────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-warning{ color: var(--warning); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.fw-bold     { font-weight: 600; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-16{ margin-bottom: 16px; }
.mb-20{ margin-bottom: 20px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.w-100 { width: 100%; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

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