/* style.css – Modern Dashboard UI */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-secondary: #e5e7eb;
  --color-secondary-hover: #d1d5db;
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-warning: #f59e0b;
  --color-success: #22c55e;
  --color-bg: #f8f9fa;
  --color-sidebar-bg: #111827;
  --color-sidebar-icon-bg: #374151;
  --color-text: #111827;
  --color-text-light: #f9fafb;
  --color-border: #e5e7eb;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --border-radius: 8px;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
aside.sidebar {
  width: 60px;
  background: var(--color-sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  gap: 1rem;
}

.sidebar-icon {
  width: 32px;
  height: 32px;
  background: var(--color-sidebar-icon-bg);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-light);
  font-size: 1.25rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.sidebar-icon:hover {
  background: var(--color-primary);
}

/* --- Main Dashboard --- */
.dashboard {
  flex: 1;
  padding: 2rem;
  max-width: calc(100% - 100px);
}

.dashboard-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
}

.dashboard-header h1 {
  font-size: 1.75rem;
  margin: 0;
  font-weight: 600;
}

.dashboard-actions {
  display: flex;
  gap: 0.75rem;
}

/* --- Buttons --- */
.btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-block;
  text-align: center;
}
.btn-primary { background-color: var(--color-primary); color: white; }
.btn-primary:hover { background-color: var(--color-primary-hover); }
.btn-secondary { background-color: var(--color-secondary); color: var(--color-text); }
.btn-secondary:hover { background-color: var(--color-secondary-hover); }
.btn-logout { background-color: var(--color-danger); color: white; }
.btn-logout:hover { background-color: var(--color-danger-hover); }

/* --- Filter & Search --- */
.filter-controls {
  margin-bottom: 1.5rem;
}
.filter-controls .search-input {
  padding: 0.6rem 1rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
  font-size: 1rem;
  min-width: 300px;
}


/* --- Table --- */
.table-container {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
thead {
  background-color: #f9fafb;
}
th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  font-weight: 600;
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover {
  background-color: #f9fafb;
}

/* --- Header Filters --- */
.filterable-header {
    cursor: pointer;
    position: relative;
    user-select: none;
}
.filterable-header .filter-icon {
    font-size: 0.7em;
    margin-left: 4px;
    transition: transform 0.2s ease;
}
.filterable-header:hover {
    background-color: #f0f2f5;
}
.filterable-header.is-filtered .header-text {
    color: var(--color-primary);
    font-weight: 700;
}
.filter-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 10;
    overflow: hidden;
}
.filter-dropdown.active {
    display: block;
}
.filter-option {
    padding: 0.75rem 1rem;
    white-space: nowrap;
}
.filter-option:hover {
    background-color: #f0f2f5;
}


.actions-cell {
  text-align: right;
}
.action-btn {
  margin: 0 0.5rem;
  text-decoration: none;
  font-size: 1.2rem;
}

/* --- Status Badges --- */
.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: white;
  white-space: nowrap;
}
.status-ok { background-color: var(--color-success); }
.status-warn { background-color: var(--color-warning); }
.status-error { background-color: var(--color-danger); }


/* --- Login Page --- */
.login-container {
  margin: auto;
  padding: 2rem;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
}
.login-container h2 { text-align: center; }
.login-container form { display: flex; flex-direction: column; gap: 1rem; }
.login-container label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 500; }
.login-container input { padding: 0.6rem; border: 1px solid var(--color-border); border-radius: 6px; }
.login-container button { padding: 0.75rem; background: var(--color-primary); color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 1rem;}


/* --- Add/Edit Form --- */
.form-view { background-color: #fff; padding: 2rem; border-radius: var(--border-radius); box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.form-group { display: flex; flex-direction: column; }
.form-group.form-group-full { grid-column: 1 / -1; }
.form-group label { margin-bottom: 0.5rem; font-weight: 500; font-size: 0.9rem; }
.form-group input, .form-group select { padding: 0.6rem 0.8rem; border: 1px solid var(--color-border); border-radius: 6px; font-size: 1rem; width: 100%; box-sizing: border-box; }
.form-actions { margin-top: 2rem; }

/* Responsive */
@media (max-width: 768px) {
  .dashboard { padding: 1rem; max-width: 100%; }
  .dashboard-header { flex-direction: column; align-items: stretch; }
  .filter-controls { flex-direction: column; }
  table { display: block; }
  thead { display: none; }
  tr { display: block; margin-bottom: 1rem; border: 1px solid var(--color-border); border-radius: var(--border-radius); }
  td { display: block; text-align: right; padding-left: 50%; position: relative; border-bottom: 1px solid #eee; }
  td:last-child { border-bottom: none; }
  td::before { content: attr(data-label); position: absolute; left: 1rem; font-weight: bold; text-align: left; }
  .actions-cell { text-align: right; }
  .actions-cell a { margin: 0 0.25rem; }
}