/* Viktor Net - Data Hub Styles */

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #1a1a1a;
  --bg-hover: #252525;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --border: #27272a;
  --border-light: #3f3f46;
  --success: #22c55e;
  --warning: #eab308;
  --error: #ef4444;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Loading Spinner */
#loading {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

/* Auth Gate */
#auth-gate, #access-denied {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 3rem;
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.login-logo { font-size: 3rem; margin-bottom: 1rem; }

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #fff 0%, #a855f7 50%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle { color: var(--text-secondary); margin-bottom: 2rem; }

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: #fff;
  color: #1f1f1f;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.google-btn:hover { background: #f3f4f6; transform: translateY(-2px); }

.google-btn.secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.google-btn.secondary:hover {
  background: var(--border);
}

.login-note { margin-top: 1.5rem; font-size: 0.875rem; color: var(--text-muted); }

/* Header */
.header {
  display: flex;
  justify-content: center;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(10px);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1200px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-icon { font-size: 1.5rem; }

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.nav-link:hover { color: var(--text-primary); }
.nav-link.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.btn-signout {
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-signout:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Main Content */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6rem 2rem 2rem;
}

/* Stats Section */
.stats-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  font-size: 1.5rem;
  width: 48px;
  height: 48px;
  background: var(--accent-glow);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.stat-value.status-online { color: var(--success); font-size: 1rem; }

.stat-label {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

/* Dashboard Sections */
.dashboard-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

.badge {
  padding: 0.25rem 0.75rem;
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Activity Feed */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--bg-primary);
  border-radius: 0.5rem;
  transition: background 0.2s;
}

.activity-item:hover {
  background: var(--bg-hover);
}

.activity-icon {
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  background: var(--accent-glow);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-content { flex: 1; }

.activity-title {
  font-weight: 500;
  margin-bottom: 0.125rem;
}

.activity-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.activity-time {
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

/* Activity Empty State */
.activity-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
}

.activity-empty .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.activity-empty p {
  color: var(--text-secondary);
  margin: 0;
}

.activity-empty .empty-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Activity Loading */
.activity-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Sites List */
.sites-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.site-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-primary);
  border-radius: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.site-row:hover {
  background: var(--bg-hover);
  transform: translateX(4px);
}

.site-row .site-icon { font-size: 1.25rem; }

.site-row .site-name {
  flex: 1;
  font-weight: 500;
}

.site-status {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.site-status.online {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.site-status.offline {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

/* Notes Section */
.notes-section {
  margin-top: 1.5rem;
}

.section-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.section-link:hover {
  color: var(--accent-hover);
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
}

.note-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.note-item:hover {
  background: var(--bg-hover);
}

.note-item:hover .note-delete {
  opacity: 1;
}

.note-content {
  flex: 1;
  min-width: 0;
}

.note-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-preview {
  color: var(--text-muted);
  font-size: 0.875rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.note-source {
  font-size: 0.7rem;
  padding: 0.125rem 0.5rem;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 0.25rem;
  font-weight: 500;
}

.note-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.note-delete {
  opacity: 0;
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  transition: opacity 0.2s;
}

.note-delete:hover {
  color: #ff6b6b;
}

.notes-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.notes-empty .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.notes-empty p {
  color: var(--text-secondary);
  margin: 0;
}

.notes-empty .empty-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Note Expanded View */
.note-expanded {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
}

.note-expanded-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 2rem;
}

.note-expanded-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.note-expanded-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.note-expanded-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0;
  line-height: 1;
}

.note-expanded-close:hover {
  color: var(--text-primary);
}

.note-expanded-body {
  color: var(--text-secondary);
  line-height: 1.8;
  white-space: pre-wrap;
}

/* AI Chat Widget */
.chat-widget {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
  z-index: 999;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.chat-icon {
  font-size: 1.25rem;
}

.chat-header span:nth-child(2) {
  flex: 1;
  font-weight: 600;
}

.chat-toggle {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.chat-widget.collapsed .chat-toggle {
  transform: rotate(180deg);
}

.chat-widget.collapsed .chat-body {
  display: none;
}

.chat-body {
  display: flex;
  flex-direction: column;
  height: 350px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-message {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat-message.user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.chat-message.assistant {
  align-self: flex-start;
  background: var(--bg-primary);
  border-bottom-left-radius: 0.25rem;
}

.chat-message p {
  margin: 0;
}

.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.chat-input-area input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.chat-input-area input:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-input-area button {
  padding: 0.75rem 1rem;
  background: var(--accent);
  border: none;
  border-radius: 0.5rem;
  color: white;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

.chat-input-area button:hover {
  background: var(--accent-hover);
}

.chat-input-area button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-no-key {
  padding: 2rem 1rem;
  text-align: center;
}

.chat-no-key p {
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.chat-no-key a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.chat-no-key a:hover {
  text-decoration: underline;
}

.chat-typing {
  display: flex;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  background: var(--bg-primary);
  border-radius: 1rem;
  width: fit-content;
}

.chat-typing span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 2rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .stats-section { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .header { padding: 1rem; }
  .header-content { flex-wrap: wrap; gap: 1rem; }
  .nav { display: none; }
  .main-content { padding: 5rem 1rem 1rem; }
  .stats-section { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-section { grid-template-columns: 1fr; }
  .chat-widget {
    width: calc(100% - 32px);
    right: 16px;
    left: 16px;
  }
}
