/* ============================================
   DEVRIYE ADMIN PANEL - STYLE.CSS
   ============================================ */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-card2: #334155;
  --sidebar-w: 260px;
  --header-h: 64px;
  --border: rgba(255,255,255,0.08);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-faint: #475569;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); overflow: hidden; }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar.hidden { transform: translateX(calc(-1 * var(--sidebar-w))); }

.sidebar-logo {
  display: flex; align-items: center; gap: 14px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}
.logo-icon { font-size: 36px; color: var(--primary-light); }
.sidebar-logo h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.sidebar-logo small { font-size: 11px; color: var(--text-faint); }

.sidebar-nav {
  flex: 1; padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover { background: rgba(99,102,241,0.08); color: var(--text); }
.nav-item.active { background: rgba(99,102,241,0.15); color: var(--primary-light); }
.nav-item .material-icons-round { font-size: 20px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 20px;
  min-width: 22px; text-align: center;
}
.nav-badge:empty, .nav-badge[data-count="0"] { display: none; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.connection-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted); margin-bottom: 6px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.offline { background: var(--danger); }
.sidebar-time { font-size: 13px; color: var(--text-muted); font-weight: 600; }

/* ===== MAIN ===== */
.main-wrapper {
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  height: 100vh;
  transition: margin-left var(--transition);
}
.main-wrapper.full { margin-left: 0; }

/* ===== HEADER ===== */
.top-header {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: rgba(30,41,59,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; position: sticky; top: 0; z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.menu-toggle {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); padding: 8px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.menu-toggle:hover { background: var(--bg-card2); color: var(--text); }
.menu-toggle .material-icons-round { font-size: 22px; }
.page-title { font-size: 18px; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-btn {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); padding: 8px; border-radius: 8px;
  display: flex; align-items: center; transition: all var(--transition);
}
.header-btn:hover { background: var(--bg-card2); color: var(--text); }
.header-btn .material-icons-round { font-size: 20px; }
.header-date { font-size: 13px; color: var(--text-muted); }

/* ===== CONTENT ===== */
.content {
  flex: 1; overflow-y: auto;
  padding: 24px;
}

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  position: relative; overflow: hidden;
  transition: transform var(--transition);
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card-glow {
  position: absolute; top: -20px; right: -20px;
  width: 80px; height: 80px; border-radius: 50%;
  opacity: 0.1;
  filter: blur(20px);
}
.stat-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon .material-icons-round { font-size: 28px; color: #fff; }
.stat-info { flex: 1; }
.stat-value { font-size: 32px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-trend { font-size: 12px; color: var(--success); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat-trend .material-icons-round { font-size: 14px; }

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dashboard-grid .full-width { grid-column: 1 / -1; }
@media (max-width: 1200px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-header h3 .material-icons-round { font-size: 18px; color: var(--primary-light); }
.card-body { padding: 16px 20px; }

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.3px;
}
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-info { background: rgba(6,182,212,0.15); color: var(--info); }
.badge-primary { background: rgba(99,102,241,0.15); color: var(--primary-light); }
.badge-gray { background: rgba(100,116,139,0.15); color: var(--text-muted); }

/* ===== DEVICE TYPE ICON ===== */
.type-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
}
.type-icon .material-icons-round { font-size: 18px; color: #fff; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: none;
  font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--transition); text-decoration: none;
}
.btn:hover { opacity: 0.85; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary-light); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn .material-icons-round { font-size: 16px; }

/* ===== FILTERS ===== */
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; flex: 1; min-width: 200px;
}
.filter-search input {
  background: transparent; border: none; outline: none;
  color: var(--text); font-family: 'Inter', sans-serif; font-size: 14px; flex: 1;
}
.filter-search input::placeholder { color: var(--text-faint); }
.filter-search .material-icons-round { color: var(--text-faint); font-size: 18px; }
select.filter-select {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 14px;
  color: var(--text); font-family: 'Inter', sans-serif; font-size: 13px;
  outline: none; cursor: pointer;
}

/* ===== CHART ===== */
.chart-container { position: relative; height: 200px; }
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 100%; padding-top: 10px; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar-track { flex: 1; display: flex; align-items: flex-end; gap: 2px; width: 100%; }
.bar { flex: 1; border-radius: 4px 4px 0 0; transition: height 0.5s ease; min-height: 2px; }
.bar-pass { background: linear-gradient(to top, var(--success), #34d399); }
.bar-fail { background: linear-gradient(to top, var(--danger), #f87171); }
.bar-label { font-size: 10px; color: var(--text-faint); white-space: nowrap; }

/* ===== ISSUE LIST ===== */
.issue-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.issue-item:last-child { border-bottom: none; }
.issue-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.issue-name { flex: 1; font-size: 13px; font-weight: 500; }
.issue-count { font-size: 20px; font-weight: 800; }
.issue-bar { height: 4px; border-radius: 2px; margin-top: 4px; max-width: 100%; }

/* ===== MAINTENANCE LIST ===== */
.maintenance-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.maintenance-item:last-child { border-bottom: none; }
.maintenance-date { font-size: 11px; font-weight: 700; text-align: center; min-width: 40px; }
.maintenance-date .day { font-size: 20px; font-weight: 800; display: block; line-height: 1; }
.maintenance-date .month { color: var(--text-faint); text-transform: uppercase; }
.maintenance-info { flex: 1; }
.maintenance-info .device-n { font-size: 13px; font-weight: 600; }
.maintenance-info .device-l { font-size: 11px; color: var(--text-muted); }

/* ===== REPORT DETAIL ===== */
.report-detail {
  padding: 20px;
}
.report-detail-img { width: 100%; max-height: 300px; object-fit: contain; border-radius: 10px; margin-bottom: 16px; background: #000; }
.detail-field { margin-bottom: 14px; }
.detail-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-faint); margin-bottom: 4px; }
.detail-value { font-size: 14px; color: var(--text); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--bg-card); border-radius: 20px; border: 1px solid var(--border);
  width: 90%; max-width: 700px; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: modal-in 0.25s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-card);
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); padding: 6px; border-radius: 8px;
  display: flex; transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-card2); color: var(--text); }
.modal-close .material-icons-round { font-size: 22px; }

/* ===== FORM ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 20px 24px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.form-input {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--text); font-family: 'Inter', sans-serif; font-size: 14px; outline: none;
  transition: border-color var(--transition);
}
.form-input:focus { border-color: var(--primary); }
.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 24px; border-top: 1px solid var(--border);
}

/* ===== TOAST ===== */
.admin-toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 20px;
  font-size: 14px; font-weight: 500; z-index: 9000;
  box-shadow: var(--shadow); min-width: 280px; max-width: 400px;
  animation: toast-slide 0.3s ease;
}
.admin-toast.hidden { display: none; }
.admin-toast.success { border-color: rgba(16,185,129,0.5); color: var(--success); }
.admin-toast.error { border-color: rgba(239,68,68,0.5); color: var(--danger); }
@keyframes toast-slide {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== LOADING ===== */
.page-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 60px; gap: 12px; color: var(--text-muted);
}
.page-loading::before {
  content: '';
  width: 24px; height: 24px;
  border: 3px solid rgba(99,102,241,0.2);
  border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-card2); border-radius: 4px; }

.empty-table { padding: 40px; text-align: center; color: var(--text-muted); font-size: 14px; }
.empty-table .material-icons-round { font-size: 48px; display: block; color: var(--text-faint); margin-bottom: 12px; }

/* Inspection items table */
.insp-item-row td { padding: 8px 14px; }
.insp-item-row.pass { background: rgba(16,185,129,0.04); }
.insp-item-row.fail { background: rgba(239,68,68,0.04); }
.insp-photo { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; cursor: pointer; }
