/* Admin Panel Styles — Libra Hospitality BCards */

/* === Layout === */
body {
  margin: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-align: center;
}
.sidebar-logo img { filter: brightness(0) invert(1); opacity: 0.9; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; cursor: pointer;
  transition: all 0.2s ease; border-left: 3px solid transparent;
  font-size: 14px; font-weight: 500;
}
.nav-item:hover { background: var(--sidebar-active); color: #fff; }
.nav-item.active {
  background: var(--sidebar-active); color: var(--sidebar-text-active);
  border-left-color: var(--secondary);
}
.nav-icon { font-size: 18px; width: 24px; text-align: center; }
.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sidebar-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--secondary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-user-role { font-size: 11px; color: var(--sidebar-text); text-transform: capitalize; }
.sidebar-logout {
  width: 100%; padding: 8px; border: 1px solid rgba(255,255,255,0.1);
  background: transparent; color: var(--sidebar-text); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 12px; transition: all 0.2s;
}
.sidebar-logout:hover { background: rgba(239,68,68,0.15); color: #EF4444; border-color: rgba(239,68,68,0.3); }

/* === Mobile === */
.mobile-header {
  display: none; position: fixed; top: 0; left: 0; right: 0; height: 56px;
  background: var(--sidebar-bg); padding: 0 16px; z-index: 99;
  align-items: center; gap: 12px;
}
.hamburger {
  background: none; border: none; padding: 8px; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px;
}
.hamburger span {
  width: 22px; height: 2px; background: #fff; transition: all 0.3s;
  display: block; border-radius: 2px;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 99; opacity: 0; transition: opacity 0.3s;
}
.sidebar-overlay.active { display: block; opacity: 1; }

@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; padding-top: 72px !important; }
}

/* === Main Content === */
.main-content {
  margin-left: 260px; flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}
.main-header {
  background: var(--surface); padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
  box-shadow: var(--shadow-sm);
}
.page-title { font-size: 20px; font-weight: 700; margin: 0; color: var(--text-primary); }
.header-actions { display: flex; gap: 10px; align-items: center; }
.content-area { padding: 24px 32px; flex: 1; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  cursor: pointer; border: none; transition: all 0.2s ease;
  font-family: inherit; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-danger { background: transparent; color: var(--error); border: 1px solid var(--error); }
.btn-danger:hover { background: var(--error); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* === Tables === */
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.data-table thead { background: var(--bg-main); }
.data-table th {
  padding: 12px 16px; text-align: left; font-size: 12px;
  font-weight: 600; color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr { transition: background 0.15s; cursor: pointer; }
.data-table tbody tr:hover { background: var(--primary-light); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Avatar in table */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: #fff; flex-shrink: 0;
  background: var(--primary);
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: top; }
.employee-cell { display: flex; align-items: center; gap: 12px; }
.employee-name { font-weight: 600; font-size: 14px; }

/* Status badge */
.badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-active { background: #D1FAE5; color: #059669; }
.badge-inactive { background: #FEE2E2; color: #DC2626; }

/* Row actions */
.row-actions { position: relative; }
.row-actions-btn {
  background: none; border: none; cursor: pointer; padding: 6px 10px;
  font-size: 18px; color: var(--text-secondary); border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.row-actions-btn:hover { background: var(--bg-main); }
.row-actions-menu {
  position: absolute; right: 0; bottom: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); min-width: 200px; z-index: 50;
  display: none;
}
.row-actions-menu.active { display: block; animation: scaleIn 0.15s ease; }
.row-actions-menu-item {
  padding: 10px 16px; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: background 0.15s; border: none; background: none;
  width: 100%; text-align: left; color: var(--text-primary); font-family: inherit;
}
.row-actions-menu-item:hover { background: var(--bg-main); }
.row-actions-menu-item.danger { color: var(--error); }

/* === Forms === */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
  background: var(--surface); color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(123,173,194,0.15);
}
.form-textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* File upload */
.file-upload {
  border: 2px dashed var(--border); border-radius: var(--radius-md);
  padding: 32px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--bg-main);
}
.file-upload:hover, .file-upload.dragover {
  border-color: var(--secondary); background: rgba(123,173,194,0.05);
}
.file-upload-icon { font-size: 36px; margin-bottom: 8px; }
.file-upload-text { font-size: 14px; color: var(--text-secondary); }
.file-upload-preview { max-width: 120px; max-height: 120px; border-radius: var(--radius-sm); margin-top: 10px; }

/* Color picker */
.color-picker-group { display: flex; align-items: center; gap: 12px; }
.color-picker-group input[type="color"] {
  width: 48px; height: 48px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; padding: 2px;
}

/* === Cards / Panels === */
.panel {
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); padding: 24px; margin-bottom: 20px;
}
.panel-title { font-size: 16px; font-weight: 700; margin: 0 0 16px; }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius-md);
  padding: 20px; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.stat-icon.blue { background: rgba(43,62,111,0.1); }
.stat-icon.green { background: rgba(16,185,129,0.1); }
.stat-icon.orange { background: rgba(232,85,61,0.1); }
.stat-icon.purple { background: rgba(123,173,194,0.1); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Chart container */
.chart-container { background: var(--surface); border-radius: var(--radius-md); padding: 24px; box-shadow: var(--shadow-sm); margin-bottom: 24px; }
.chart-container canvas { width: 100% !important; max-height: 300px; }

/* === Card Editor === */
.editor-layout { display: grid; grid-template-columns: 1fr 380px; gap: 24px; }
.editor-form { display: flex; flex-direction: column; gap: 20px; }
.editor-preview {
  position: sticky; top: 100px;
  background: var(--bg-main); border-radius: var(--radius-md);
  padding: 20px; height: fit-content;
}
.editor-preview-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; text-align: center; }

/* Field cards in editor */
.field-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: box-shadow 0.2s; animation: fadeIn 0.2s ease;
}
.field-card:hover { box-shadow: var(--shadow-md); }
.field-drag-handle {
  cursor: grab; color: var(--text-secondary); font-size: 16px;
  padding: 4px; user-select: none;
}
.field-drag-handle:active { cursor: grabbing; }
.field-card-content { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.field-card-row { display: flex; gap: 8px; }
.field-card-row .form-input, .field-card-row .form-select { flex: 1; padding: 8px 10px; font-size: 13px; }
.field-remove-btn {
  background: none; border: none; color: var(--error); cursor: pointer;
  font-size: 18px; padding: 4px; opacity: 0.5; transition: opacity 0.2s;
}
.field-remove-btn:hover { opacity: 1; }

.add-field-btn {
  width: 100%; padding: 14px; border: 2px dashed var(--border);
  border-radius: var(--radius-md); background: transparent;
  color: var(--secondary); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.add-field-btn:hover { border-color: var(--secondary); background: rgba(123,173,194,0.05); }

.editor-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 12px; }

@media (max-width: 1024px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-preview { display: none; }
}

/* === Modal === */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-content {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 90%; max-width: 560px;
  max-height: 85vh; overflow-y: auto;
  animation: scaleIn 0.2s ease;
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 24px; cursor: pointer;
  color: var(--text-secondary); padding: 4px; line-height: 1;
}
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-lg { max-width: 720px; }

/* === Toast === */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }

/* === Search === */
.search-box {
  position: relative; margin-bottom: 20px;
}
.search-input {
  width: 100%; padding: 12px 16px 12px 42px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: 14px; background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.search-input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(123,173,194,0.15); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--text-secondary); }

/* === Pagination === */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.page-btn {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; font-size: 13px;
  transition: all 0.2s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

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

/* === Loading skeleton === */
.loading-skeleton { padding: 20px; }
.skeleton-row {
  height: 50px; background: linear-gradient(90deg, var(--bg-main) 25%, #e8eaed 50%, var(--bg-main) 75%);
  background-size: 200% 100%; border-radius: var(--radius-sm);
  margin-bottom: 12px; animation: shimmer 1.5s infinite;
}

/* === Department list === */
.dept-list { list-style: none; padding: 0; margin: 0; }
.dept-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.dept-item:last-child { border-bottom: none; }
.dept-delete-btn {
  background: none; border: none; color: var(--error); cursor: pointer;
  font-size: 16px; opacity: 0.5; transition: opacity 0.2s;
}
.dept-delete-btn:hover { opacity: 1; }

/* === Tabs === */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 12px 24px; border: none; background: transparent;
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.2s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* === Animations === */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
