@import url('https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400;500&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg-color: #ffffff;
  --sidebar-bg: #f0f4ff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --accent-purple: #6c47ff;
  --accent-success: #22c55e;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --border-color: #e5e7eb;
  
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'Fira Mono', monospace;
  
  --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-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-main);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background-color: var(--accent-purple);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 1.2rem;
}

.brand-name {
  font-weight: 700;
  font-size: 1.125rem;
}

.sidebar-nav {
  padding: 1rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 0.5rem;
  transition: all 0.2s;
}

.nav-item:hover {
  background-color: rgba(108, 71, 255, 0.1);
  color: var(--accent-purple);
}

.nav-item.active {
  background-color: var(--accent-purple);
  color: white;
}

/* Badge */
.badge {
  padding: 0.25em 0.6em;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-beta {
  background-color: rgba(108, 71, 255, 0.1);
  color: var(--accent-purple);
  margin-left: auto;
}
.badge-success { background-color: rgba(34, 197, 94, 0.1); color: var(--accent-success); }
.badge-warning { background-color: rgba(245, 158, 11, 0.1); color: var(--accent-warning); }
.badge-danger { background-color: rgba(239, 68, 68, 0.1); color: var(--accent-danger); }

/* Main Content */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Image styles for prompt requirement */
.img-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fafafa;
  overflow: hidden;
  border-radius: var(--radius-sm);
}
.img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-width: 100%;
  display: block;
}

/* Topbar */
.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background-color: var(--bg-color);
  flex-shrink: 0;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #f3f4f6;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  width: 300px;
}
.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-family: var(--font-main);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--accent-purple);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Notification Bar */
.notification-bar {
  background-color: rgba(108, 71, 255, 0.1);
  color: var(--accent-purple);
  padding: 0.75rem 2rem;
  font-weight: 500;
  font-size: 0.875rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(108, 71, 255, 0.2);
}

/* Dashboard Layout */
.dashboard {
  display: grid;
  grid-template-columns: 1fr 350px;
  height: calc(100vh - 64px - 44px); /* assuming topbar+notif */
  overflow: hidden;
}

.widgets-grid {
  padding: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  overflow-y: auto;
  align-content: flex-start;
  background-color: #fafafa;
}

/* Right Panel (Admin Panel) */
.right-panel {
  border-left: 1px solid var(--border-color);
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.panel-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-header h3 {
  font-size: 1rem;
  font-weight: 600;
}
#admin-panel {
  padding: 1.5rem;
  flex-grow: 1;
  overflow-y: auto;
  font-size: 0.875rem;
}
.admin-loading {
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  height: 100%;
  font-family: var(--font-main);
}
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Flag & Admin panel styling */
.admin-flag-panel {
  background: rgba(34, 197, 94, 0.05);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}
.admin-flag-panel h4 {
  margin: 1rem 0;
  font-size: 1.125rem;
  color: var(--text-main);
}
.admin-flag-panel p {
  color: var(--text-muted);
  margin-top: 1rem;
}
.code-block {
  background: #111827;
  color: #10b981;
  font-family: var(--font-mono);
  padding: 1rem;
  border-radius: var(--radius-sm);
  word-break: break-all;
  font-weight: bold;
}

/* Widget Card styling */
.widget-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.widget-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.widget-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-color);
}
.widget-title {
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.widget-iframe-container {
  height: 280px;
  width: 100%;
  background: #fafafa;
}
.widget-iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Widget.html specific styling */
.widget-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 100%;
  background-color: transparent;
}
.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.metric {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}
.metric span {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.trend {
  color: var(--accent-success);
  font-weight: 600;
  background: rgba(34, 197, 94, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.chart-placeholder {
  flex-grow: 1;
  background: linear-gradient(180deg, rgba(108, 71, 255, 0.1) 0%, rgba(108, 71, 255, 0) 100%);
  border-radius: var(--radius-sm);
  border-bottom: 2px solid var(--accent-purple);
  position: relative;
  overflow: hidden;
}
.chart-bar {
  position: absolute;
  bottom: 0;
  width: 12%;
  background-color: var(--accent-purple);
  border-radius: 2px 2px 0 0;
  opacity: 0.8;
  animation: barRise 1s ease-out forwards;
}

@keyframes barRise {
  from { transform: scaleY(0); transform-origin: bottom; }
  to { transform: scaleY(1); transform-origin: bottom; }
}

/* For Attacker Page */
.attacker-layout {
  font-family: var(--font-mono);
  background-color: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
  padding: 3rem;
  display: block;
}
.attacker-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid #334155;
  padding-bottom: 1rem;
}
.attacker-header h1 {
  color: var(--accent-danger);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.attacker-header p {
  color: #94a3b8;
  font-size: 0.875rem;
}
.attacker-section {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}
.attacker-btn {
  background-color: var(--accent-danger);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-weight: bold;
  cursor: pointer;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.attacker-btn:hover {
  background-color: #dc2626;
  transform: translateY(-1px);
}
.log-box {
  background: #020617;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  padding: 1rem;
  min-height: 200px;
  font-family: monospace;
  font-size: 0.875rem;
  overflow-y: auto;
  color: #38bdf8;
  line-height: 1.5;
}
.log-meta { color: #64748b; }
.log-success { color: #4ade80; }
.log-error { color: #f87171; }
.log-data { color: #fde047; }

/* Fake image containers */
.fake-image {
  background: repeating-linear-gradient(
    45deg,
    #f3f4f6,
    #f3f4f6 10px,
    #e5e7eb 10px,
    #e5e7eb 20px
  );
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: bold;
  font-size: 0.875rem;
}
