/* ISP Manager Pro - Complete Stylesheet */

:root {
  --bg-primary: #0F172A;
  --bg-secondary: #1E293B;
  --bg-card: rgba(30, 41, 59, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-glass: rgba(255, 255, 255, 0.1);
  --blue-primary: #2563EB;
  --blue-light: #38BDF8;
  --blue-dark: #1D4ED8;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #38BDF8;
  --purple: #7C3AED;
  --sidebar-width: 260px;
  --header-height: 65px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
  --transition: all 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }

body {
  font-family: 'Tajawal', 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ====== LAYOUT WRAPPER ====== */
.layout-wrapper {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  width: 100%;
}

/* ====== SIDEBAR ====== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.97);
  border-left: 1px solid var(--border-glass);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

/* ====== MAIN CONTENT ====== */
.main-content {
  flex: 1;
  min-height: 100vh;
  overflow-x: hidden;
  min-width: 0;
}

.sidebar-brand {
  padding: 20px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand .logo {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--blue-primary), var(--blue-light));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.sidebar-brand .brand-text h2 { font-size: 1rem; font-weight: 700; }
.sidebar-brand .brand-text span { font-size: 0.75rem; color: var(--text-muted); }

.nav-section { padding: 16px 12px 8px; }
.nav-section-title {
  font-size: 0.7rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px; padding: 0 8px 8px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary); text-decoration: none;
  transition: var(--transition); margin-bottom: 2px;
  font-size: 0.9rem; cursor: pointer;
}
.nav-item:hover { background: var(--bg-glass); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(37,99,235,0.3), rgba(56,189,248,0.15));
  color: var(--blue-light); border-right: 3px solid var(--blue-light);
}
.nav-item .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }
.nav-item .nav-badge {
  margin-right: auto; background: var(--danger); color: white;
  font-size: 0.65rem; padding: 1px 6px; border-radius: 20px; font-weight: 600;
}

.sidebar-footer { margin-top: auto; padding: 16px; border-top: 1px solid var(--border-glass); }
.user-info {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: var(--radius-sm); background: var(--bg-glass);
}
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--blue-primary), var(--purple));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.user-details .name { font-size: 0.85rem; font-weight: 600; }
.user-details .role { font-size: 0.72rem; color: var(--text-muted); }

/* ====== TOP HEADER ====== */
.top-header {
  height: var(--header-height);
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border-glass);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
}
.page-title { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-btn {
  width: 38px; height: 38px; background: var(--bg-glass);
  border: 1px solid var(--border-glass); border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: var(--transition); text-decoration: none;
}
.header-btn:hover { background: var(--blue-primary); color: white; }

.content-area { 
  padding: 24px;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* ====== CARDS ====== */
.card {
  background: var(--bg-card); backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass); border-radius: var(--radius);
  padding: 20px; transition: var(--transition);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border-glass);
}
.card-title { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }

/* ====== STAT CARDS ====== */
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border-glass);
  border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; gap: 16px;
  transition: var(--transition); position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--card-color, var(--blue-primary));
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 52px; height: 52px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.stat-info .value { font-size: 1.8rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-info .label { font-size: 0.8rem; color: var(--text-secondary); }
.stat-info .change { font-size: 0.75rem; margin-top: 4px; }
.change.up { color: var(--success); }
.change.down { color: var(--danger); }

/* ====== GRID ====== */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ====== TABLE ====== */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: rgba(255,255,255,0.04); }
th {
  padding: 12px 14px; text-align: right;
  font-size: 0.78rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 0.88rem; color: var(--text-secondary); }
tbody tr:hover td { background: rgba(255,255,255,0.03); }
tbody tr:last-child td { border-bottom: none; }

/* ====== BUTTONS ====== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 600; cursor: pointer;
  border: none; transition: var(--transition); text-decoration: none;
  font-family: inherit;
}
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }
.btn-primary { background: linear-gradient(135deg, var(--blue-primary), var(--blue-dark)); color: white; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(37,99,235,0.4); }
.btn-info { background: linear-gradient(135deg, var(--info), #0ea5e9); color: white; }
.btn-success { background: linear-gradient(135deg, var(--success), #059669); color: white; }
.btn-warning { background: linear-gradient(135deg, var(--warning), #d97706); color: white; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #dc2626); color: white; }
.btn-secondary { background: var(--bg-glass); color: var(--text-secondary); border: 1px solid var(--border-glass); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-glass); color: var(--text-primary); }

/* ====== FORMS ====== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.form-control {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 0.9rem; font-family: inherit; transition: var(--transition); direction: rtl;
}
.form-control:focus { outline: none; border-color: var(--blue-primary); background: rgba(37,99,235,0.08); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control {
  cursor: pointer;
  background-color: rgba(255,255,255,0.06) !important;
  color: #F1F5F9 !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394A3B8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 32px;
}
select.form-control option {
  background-color: #1E293B !important;
  color: #F1F5F9 !important;
}

/* ====== BADGES ====== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px; font-size: 0.74rem; font-weight: 600;
}
.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(56,189,248,0.15); color: var(--info); }
.badge-secondary { background: rgba(100,116,139,0.15); color: var(--text-muted); }
.badge-primary { background: rgba(37,99,235,0.15); color: var(--blue-light); }

/* ====== ALERTS ====== */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 12px; font-size: 0.88rem;
}
.alert-warning { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); color: #FCD34D; }
.alert-danger  { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.3);  color: #FCA5A5; }
.alert-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: #6EE7B7; }
.alert-info    { background: rgba(56,189,248,0.12); border: 1px solid rgba(56,189,248,0.3); color: #7DD3FC; }

/* ====== MODAL ====== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  z-index: 2000; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border-glass);
  border-radius: var(--radius); width: 90%; max-width: 600px;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border-glass);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border-glass);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ====== SEARCH ====== */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-glass); border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm); padding: 8px 14px;
}
.search-bar input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-family: inherit; font-size: 0.9rem; width: 200px;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* ====== PAGE HEADER ====== */
.page-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
}
.page-header h1 { font-size: 1.4rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.page-header .breadcrumb { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }

/* ====== TABS ====== */
.tabs {
  display: flex; gap: 4px; background: var(--bg-glass);
  border: 1px solid var(--border-glass); border-radius: var(--radius-sm);
  padding: 4px; margin-bottom: 20px;
}
.tab-btn {
  flex: 1; padding: 8px 14px; border-radius: 6px; border: none;
  background: none; color: var(--text-muted); font-family: inherit;
  font-size: 0.85rem; cursor: pointer; transition: var(--transition);
}
.tab-btn.active { background: var(--blue-primary); color: white; }

/* ====== PROGRESS ====== */
.progress { height: 6px; background: rgba(255,255,255,0.08); border-radius: 10px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 10px; transition: width 0.6s ease; }

/* ====== CHART ====== */
.chart-container { position: relative; height: 250px; }

/* ====== NETWORK / AREA CARDS ====== */
.area-card {
  background: var(--bg-glass); border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm); padding: 14px; transition: var(--transition);
}
.area-card:hover { border-color: rgba(56,189,248,0.3); transform: translateY(-2px); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; }
.status-dot.online  { background: var(--success); animation: pulse 2s infinite; }
.status-dot.offline { background: var(--danger); }
.status-dot.maintenance { background: var(--warning); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ====== OFFER CARD ====== */
.offer-card {
  background: linear-gradient(135deg, rgba(37,99,235,0.2), rgba(56,189,248,0.1));
  border: 1px solid rgba(37,99,235,0.3); border-radius: var(--radius);
  padding: 20px; position: relative; overflow: hidden; transition: var(--transition);
}
.offer-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.offer-badge {
  position: absolute; top: 12px; left: 12px;
  background: var(--danger); color: white;
  font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 4px;
}
.offer-discount { font-size: 2.5rem; font-weight: 800; color: var(--blue-light); }

/* ====== TICKET ====== */
.ticket-item {
  border-right: 3px solid var(--border-glass); padding: 12px 16px;
  margin-bottom: 8px; background: var(--bg-glass);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm); transition: var(--transition);
}
.ticket-item.priority-critical { border-right-color: var(--danger); }
.ticket-item.priority-high     { border-right-color: var(--warning); }
.ticket-item.priority-medium   { border-right-color: var(--blue-primary); }
.ticket-item.priority-low      { border-right-color: var(--text-muted); }

/* ====== SPEED TEST ====== */
.speedtest-container { text-align: center; padding: 30px; }

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-secondary); border-radius: 3px; }

/* ====== ANIMATIONS ====== */
.fade-in { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ====== RESPONSIVE ====== */
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .layout-wrapper { flex-direction: column; }
  .sidebar { width: 100%; min-width: 100%; height: auto; position: relative; order: 1; display: none; }
  .sidebar.open { display: flex; }
  .main-content { order: 2; width: 100%; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .content-area { padding: 16px; }
}

/* ====== UTILITIES ====== */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-blue { color: var(--blue-light) !important; }
.text-center { text-align: center; }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.p-3 { padding: 12px; } .p-4 { padding: 16px; }
.w-100 { width: 100%; }
.divider { border: none; border-top: 1px solid var(--border-glass); margin: 16px 0; }
.cursor-pointer { cursor: pointer; }

/* Prevent overflow */
input, select, textarea { max-width: 100%; }
