/* KLJB Admin Dashboard - Styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --acker-turquoise: #2A9D8F;
  --acker-brown: #8B6F47;
  --acker-gold: #E9B44C;
  --acker-cream: #F5F1E8;
  --primary: #2D5016;
  --primary-dark: #1A3009;
  --success: #28A745;
  --warning: #FFC107;
  --danger: #DC3545;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--acker-cream);
  color: #1A1A1A;
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 1rem 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

.btn-primary:hover:not(:disabled) {
  background: #238276;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-secondary {
  background: var(--acker-gold);
  color: var(--primary-dark);
}

.btn-secondary:hover:not(:disabled) {
  background: #d4a343;
}

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

.btn-danger:hover {
  background: #b91c1c;
}

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

/* Container */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  background: white;
  padding: 0.75rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  overflow-x: auto;
}

.tab {
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: #6C757D;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab:hover {
  background: rgba(42, 157, 143, 0.1);
  color: var(--acker-turquoise);
}

.tab.active {
  background: var(--acker-turquoise);
  color: white;
}

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f0f0f0;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
}

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

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border-left: 4px solid var(--acker-turquoise);
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-label {
  font-size: 0.85rem;
  color: #6C757D;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

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

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: #f8f9fa;
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.875rem;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
}

td {
  padding: 1rem;
  border-bottom: 1px solid #dee2e6;
}

tr:hover {
  background: #f8f9fa;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: #D4EDDA; color: #155724; }
.badge-warning { background: #FFF3CD; color: #856404; }
.badge-danger { background: #F8D7DA; color: #721C24; }
.badge-info { background: #D1ECF1; color: #0C5460; }
.badge-primary { background: rgba(42, 157, 143, 0.1); color: var(--acker-turquoise); }
.badge-secondary { background: rgba(233, 180, 76, 0.2); color: var(--acker-brown); }

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

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #1A1A1A;
  font-weight: 500;
  font-size: 0.9rem;
}

select, input[type="text"], input[type="search"], input[type="email"], 
input[type="password"], input[type="datetime-local"], input[type="date"], textarea {
  padding: 0.5rem 0.75rem;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border-color 0.2s;
  width: 100%;
}

select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--acker-turquoise);
}

/* Filters */
.filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 150px;
}

.filter-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #6C757D;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 2px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6C757D;
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 1.5rem;
}

/* Device Cards */
.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.device-card {
  border: 2px solid #dee2e6;
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.2s;
}

.device-card:hover {
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
  border-color: var(--acker-turquoise);
}

.device-card.selected {
  border-color: var(--acker-turquoise);
  background-color: rgba(42, 157, 143, 0.05);
}

/* Checkboxes */
.checkbox-custom {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.checkbox-custom:checked {
  background-color: var(--acker-turquoise);
  border-color: var(--acker-turquoise);
}

.checkbox-custom:checked::after {
  content: '✓';
  position: absolute;
  color: white;
  font-size: 14px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  color: #6C757D;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f0f0f0;
  border-top-color: var(--acker-turquoise);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Alerts */
.alert {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert-success { background: #D4EDDA; color: #155724; border-left: 4px solid #28A745; }
.alert-warning { background: #FFF3CD; color: #856404; border-left: 4px solid #FFC107; }
.alert-danger { background: #F8D7DA; color: #721C24; border-left: 4px solid #DC3545; }
.alert-info { background: #D1ECF1; color: #0C5460; border-left: 4px solid #17A2B8; }

/* Login Screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.login-card {
  background: white;
  padding: 3rem;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-width: 400px;
  width: 100%;
}

.login-card h2 {
  color: var(--primary);
  margin-bottom: 2rem;
  text-align: center;
  font-size: 1.75rem;
}

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .filters { flex-direction: column; }
  .filter-group { width: 100%; }
  .header h1 { font-size: 1.25rem; }
  .card { padding: 1rem; }
  .modal-content { max-width: 100%; margin: 0; }
  .devices-grid { grid-template-columns: 1fr; }
  th, td { padding: 0.75rem 0.5rem; font-size: 0.875rem; }
}

/* Utility */
.hidden { display: none !important; }
.text-muted { color: #6C757D; }
.text-small { font-size: 0.875rem; }
.font-bold { font-weight: 600; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
