/* ==========================================
   SmartOLT Modern Design System (Vanilla CSS)
   ========================================== */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-card: rgba(31, 41, 55, 0.7);
  --border-color: rgba(55, 65, 81, 0.5);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-accent: #06b6d4; /* Neon Teal */
  --text-accent-glow: rgba(6, 182, 212, 0.2);
  
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #3b82f6;
  
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 15px var(--text-accent-glow);
}

body.light-mode {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --border-color: rgba(226, 232, 240, 0.8);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-accent: #0284c7;
  --text-accent-glow: rgba(2, 132, 199, 0.15);
  
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --color-info: #2563eb;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-accent);
}

.app-container {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
}

.sidebar-brand {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-icon {
  color: var(--text-accent);
  filter: drop-shadow(0 0 4px var(--text-accent));
}

.sidebar-nav {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 15px;
  transition: var(--transition-fast);
}

.nav-item i {
  width: 20px;
  height: 20px;
}

.nav-item:hover, .nav-item.active {
  color: var(--text-main);
  background-color: var(--bg-tertiary);
}

.nav-item.active {
  background-color: var(--text-accent-glow);
  color: var(--text-accent);
  border-left: 3px solid var(--text-accent);
  box-shadow: var(--shadow-glow);
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--text-accent), var(--color-info));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
}

.user-role {
  font-size: 12px;
  color: var(--text-muted);
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.top-header {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

#page-title {
  font-size: 24px;
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-badge-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-color);
}

.dot-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-indicator.online {
  background-color: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.header-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.header-btn:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--text-accent);
}

/* CARDS & GRIDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--text-accent);
  box-shadow: var(--shadow-glow);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
}

.bg-blue { background-color: var(--color-info); }
.bg-green { background-color: var(--color-success); }
.bg-red { background-color: var(--color-danger); }
.bg-orange { background-color: var(--color-warning); }

.stat-info h3 {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-info p {
  font-size: 24px;
  font-weight: 700;
}

.content-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.col-12 { width: 100%; }
.col-8 { width: 66.66%; }
.col-6 { width: 50%; }
.col-4 { width: 33.33%; }

@media (max-width: 992px) {
  .content-row { flex-direction: column; }
  .col-8, .col-6, .col-4 { width: 100%; }
}

.content-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.border-accent {
  border-left: 4px solid var(--text-accent);
}

.card-body {
  padding: 20px;
  flex: 1;
}

.flex-column-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* BUTTONS */
.section-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-primary {
  background-color: var(--text-accent);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background-color: #0891b2;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-success {
  background-color: var(--color-success);
  color: #fff;
}

.btn-warning {
  background-color: var(--color-warning);
  color: #000;
}

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

.btn-back {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  text-decoration: none;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
}

.btn-outline {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.btn-outline:hover {
  color: var(--text-main);
  border-color: var(--text-accent);
}

/* TABLES */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th, .data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  background-color: rgba(17, 24, 39, 0.3);
}

.data-table tbody tr:hover {
  background-color: rgba(55, 65, 81, 0.2);
}

.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.bg-green { background-color: rgba(16, 185, 129, 0.15); color: var(--color-success); border: 1px solid var(--color-success); }
.bg-red { background-color: rgba(239, 68, 68, 0.15); color: var(--color-danger); border: 1px solid var(--color-danger); }
.bg-orange { background-color: rgba(245, 158, 11, 0.15); color: var(--color-warning); border: 1px solid var(--color-warning); }

/* FORMS */
.filter-panel {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-item { flex: 1; min-width: 150px; }
.search-item { flex: 2; min-width: 250px; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
}

.form-control:focus {
  outline: none;
  border-color: var(--text-accent);
  box-shadow: var(--shadow-glow);
}

.form-row { display: flex; gap: 12px; }

.form-control-static {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: 14px;
  display: block;
  width: 100%;
}

.row-inline { display: flex; align-items: center; gap: 12px; }
.inline-select { width: auto; min-width: 180px; }

/* ONU DETAILS */
.detail-container { display: flex; flex-direction: column; gap: 20px; }
.detail-table { width: 100%; border-collapse: collapse; }
.detail-table th, .detail-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-color); font-size: 14px; }
.detail-table th { color: var(--text-muted); font-weight: 500; width: 35%; text-align: left; }
.detail-table td { font-weight: 600; color: var(--text-main); }

.physical-ont-image-container {
  width: 100%;
  max-width: 250px;
  height: 80px;
  margin-bottom: 20px;
}

.ont-image-gpon {
  width: 100%;
  height: 100%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 120'%3E%3Crect x='10' y='20' width='380' height='80' rx='10' fill='%23e2e8f0' stroke='%2394a3b8' stroke-width='2'/%3E%3Ccircle cx='30' cy='60' r='8' fill='%2322c55e'/%3E%3Crect x='300' y='45' width='25' height='30' rx='2' fill='%231e293b'/%3E%3Crect x='330' y='45' width='25' height='30' rx='2' fill='%231e293b'/%3E%3Crect x='360' y='45' width='20' height='30' rx='2' fill='%231e293b'/%3E%3Crect x='80' y='50' width='180' height='10' fill='%2394a3b8'/%3E%3C/svg%3E") no-repeat center center;
  background-size: contain;
}

.ont-image-epon {
  width: 100%;
  height: 100%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 120'%3E%3Crect x='10' y='20' width='380' height='80' rx='10' fill='%23334155' stroke='%23475569' stroke-width='2'/%3E%3Ccircle cx='30' cy='60' r='8' fill='%233b82f6'/%3E%3Crect x='300' y='45' width='25' height='30' rx='2' fill='%230f172a'/%3E%3Crect x='330' y='45' width='25' height='30' rx='2' fill='%230f172a'/%3E%3Crect x='80' y='50' width='180' height='10' fill='%23475569'/%3E%3C/svg%3E") no-repeat center center;
  background-size: contain;
}

.signal-gauge-container {
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 16px;
  width: 100%;
  max-width: 320px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.signal-reading { margin-top: 10px; font-size: 15px; }
.signal-reading strong { font-size: 18px; color: var(--text-accent); }
.action-buttons-group { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.chart-container { position: relative; height: 250px; width: 100%; }

/* MODALS */
.modal {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}

.modal.open { opacity: 1; pointer-events: auto; }
.modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  transform: scale(0.9);
  transition: transform 0.2s ease-in-out;
}
.modal.open .modal-content { transform: scale(1); }
.modal-header { padding: 16px 24px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 12px; }

.error-box {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 16px;
  font-size: 13px;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--text-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ACTIVITY LIST */
.activity-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.activity-item { border-bottom: 1px solid var(--border-color); padding-bottom: 8px; font-size: 13px; }
.activity-item:last-child { border-bottom: none; }
.activity-time { font-size: 11px; color: var(--text-muted); display: block; }
.activity-text { font-weight: 500; margin-top: 2px; }

/* SIDEBAR DROPDOWN SUBMENU */
.sidebar-dropdown {
  display: flex;
  flex-direction: column;
}

.dropdown-toggle {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
}

.chevron-icon {
  margin-left: auto;
  width: 16px !important;
  height: 16px !important;
  transition: transform var(--transition-fast);
}

.sidebar-dropdown.open .chevron-icon {
  transform: rotate(180deg);
}

.dropdown-menu {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding-left: 28px;
  margin-top: 4px;
}

.sidebar-dropdown.open .dropdown-menu {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition-fast);
}

.dropdown-item:hover, .dropdown-item.active {
  color: var(--text-main);
  background-color: var(--bg-tertiary);
}

.dropdown-item.active {
  color: var(--text-accent);
  background-color: var(--text-accent-glow);
}

/* UTILITY CLASSES */
.hidden {
  display: none !important;
}
