/* ============================================
   VK-to-Telegram Bot Admin Panel
   Complete Design System & Styles
   ============================================ */

:root {
  --bg: #0a0e17;
  --surface: #1a2332;
  --surface-hover: #1f2b3d;
  --accent: #5b7cfa;
  --accent-hover: #4a6de8;
  --accent-glow: rgba(91, 124, 250, 0.15);
  --text-primary: #e8edf5;
  --text-secondary: #94a9c9;
  --text-muted: #8a9ab0;
  --border: #3a4a5f;
  --border-subtle: #1e2d42;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;
  --vk: #5181b8;
  --telegram: #2aabee;
  --radius-card: 14px;
  --radius-element: 8px;
  --radius-pill: 9999px;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --transition: 0.2s ease;
  --transition-slow: 0.3s ease;
}

[data-theme="light"] {
  --bg: #f0f4ff;
  --surface: #ffffff;
  --surface-hover: #f0f4ff;
  --accent: #5b7cfa;
  --accent-hover: #4a6de8;
  --accent-glow: rgba(91, 124, 250, 0.15);
  --text-primary: #0a0e17;
  --text-secondary: #4a5a7a;
  --text-muted: #8a9ab0;
  --border: #d0d8e8;
  --border-subtle: #e8ecf5;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #2563eb;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f0f4ff;
    --surface: #ffffff;
    --surface-hover: #f0f4ff;
    --text-primary: #0a0e17;
    --text-secondary: #4a5a7a;
    --text-muted: #8a9ab0;
    --border: #d0d8e8;
    --border-subtle: #e8ecf5;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================
   Layout & Structure
   ============================================ */

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

.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width var(--transition-slow), transform var(--transition-slow);
}

.sidebar.collapsed {
  width: 72px;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
}

.logo i {
  font-size: 1.4rem;
  color: var(--accent);
  min-width: 24px;
  text-align: center;
}

.sidebar.collapsed .logo span {
  display: none;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-element);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background: var(--border-subtle);
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-element);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
  font-size: 0.9rem;
  user-select: none;
}

.nav-item:hover {
  background: var(--border-subtle);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
}

.nav-item i {
  min-width: 20px;
  text-align: center;
  font-size: 1rem;
}

.sidebar.collapsed .nav-item span {
  display: none;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-logout,
.btn-theme {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-element);
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
}

.btn-logout:hover {
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
}

.btn-theme:hover {
  background: var(--border-subtle);
  color: var(--text-primary);
}

.bot-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-element);
  font-size: 0.8rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

.status-text {
  color: var(--text-secondary);
}

.version {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  padding-top: 4px;
}

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

.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

.sidebar.collapsed + .main-content {
  margin-left: 72px;
}

.content-area {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
  user-select: none;
  will-change: transform;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(91, 124, 250, 0.3);
}

.btn-primary:focus {
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

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

.btn-success:hover:not(:disabled) {
  background: #2cc08a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(52, 211, 153, 0.3);
}

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

.btn-warning:hover:not(:disabled) {
  background: #e5ad1e;
  transform: translateY(-1px);
}

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

.btn-danger:hover:not(:disabled) {
  background: #e55a5a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(248, 113, 113, 0.3);
}

.btn-info {
  background: var(--info);
  color: #0a0e17;
}

.btn-info:hover:not(:disabled) {
  background: #4d93e8;
  transform: translateY(-1px);
}

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

.btn-outline:hover:not(:disabled) {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-element);
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-icon:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-group {
  display: inline-flex;
  gap: 0;
}

.btn-group .btn {
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-radius: var(--radius-pill) 0 0 var(--radius-pill);
}

.btn-group .btn:last-child {
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
}

/* ============================================
   Cards
   ============================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--border);
}

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

.card-header h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-header h3 i {
  color: var(--accent);
  font-size: 0.95rem;
}

.card-body {
  padding: 20px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.card.collapsible .card-header {
  cursor: pointer;
  user-select: none;
}

.card.collapsible .card-header i.fa-chevron-up {
  transition: transform var(--transition);
}

.card.collapsible.collapsed .card-header i.fa-chevron-up {
  transform: rotate(180deg);
}

.card.collapsible.collapsed .card-body {
  display: none;
}

/* ============================================
   Stats
   ============================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  will-change: transform;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.03;
  transform: translate(20px, -20px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover .stat-icon::after {
  opacity: 1;
}

.stat-icon.vk {
  background: rgba(81, 129, 184, 0.15);
  color: var(--vk);
}

.stat-icon.tg {
  background: rgba(42, 171, 238, 0.15);
  color: var(--telegram);
}

.stat-icon.posts {
  background: rgba(91, 124, 250, 0.15);
  color: var(--accent);
}

.stat-icon.total {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.stat-info h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Bot Stats Bar */
.bot-stats-bar {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  margin-bottom: 24px;
  overflow-x: auto;
}

.bot-stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--radius-element);
  transition: all var(--transition);
  white-space: nowrap;
}

.bot-stat-item:hover {
  background: var(--border-subtle);
}

.bot-stat-item > i {
  color: var(--accent);
  font-size: 1rem;
}

.bot-stat-info {
  display: flex;
  flex-direction: column;
}

.bot-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bot-stat-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Stats Mini */
.stats-mini {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.stat-mini-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-element);
  transition: all var(--transition);
}

.stat-mini-item:hover {
  border-color: var(--border);
  transform: translateY(-1px);
}

.stat-mini-item i {
  color: var(--accent);
  font-size: 0.9rem;
}

.stat-mini-info {
  display: flex;
  flex-direction: column;
}

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

.stat-mini-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================
   Dashboard
   ============================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

.chart-container {
  position: relative;
  height: 280px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  will-change: transform;
  position: relative;
  overflow: hidden;
}

.quick-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}

.quick-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 4px 16px rgba(91, 124, 250, 0.15);
}

.quick-btn:hover::before {
  opacity: 0.05;
}

.quick-btn i {
  font-size: 1.3rem;
  position: relative;
  z-index: 1;
}

.quick-btn span {
  font-size: 0.75rem;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

.link-preview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-element);
  margin-bottom: 8px;
  transition: all var(--transition);
  cursor: pointer;
}

.link-preview-item:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.link-preview-item:hover i {
  color: var(--accent);
}

.link-preview-arrow {
  color: var(--text-muted);
  transition: color var(--transition);
}

/* ============================================
   Tables
   ============================================ */

.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--border-subtle);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

.data-table td {
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* ============================================
   Forms
   ============================================ */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group label i {
  margin-right: 6px;
  color: var(--accent);
}

.required-star {
  color: var(--danger);
  margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-element);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-family);
  transition: all var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a9c9' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group-text {
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--border-subtle);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-element) 0 0 var(--radius-element);
  color: var(--text-secondary);
  font-size: 0.85rem;
  white-space: nowrap;
}

.input-group .form-control {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius-element) var(--radius-element) 0;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-family);
  transition: all var(--transition);
}

.input-group .form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
  padding: 4px 0;
}

.checkbox-group input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-group .checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.checkbox-group:hover input ~ .checkmark {
  border-color: var(--accent);
}

.checkbox-group input:checked ~ .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-group .checkmark:after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.65rem;
  color: #fff;
  opacity: 0;
  transform: scale(0);
  transition: all var(--transition);
}

.checkbox-group input:checked ~ .checkmark:after {
  opacity: 1;
  transform: scale(1);
}

.checkbox-group label {
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  margin-bottom: 0;
}

/* Form Sections */
.form-section {
  margin-bottom: 24px;
}

.form-section h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.form-section h4 i {
  color: var(--accent);
}

.telegraph-settings {
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-element);
}

.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* Settings Tabs */
.settings-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border-radius: var(--radius-element);
  margin-bottom: 20px;
  overflow-x: auto;
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.settings-tab:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.settings-tab.active {
  background: var(--accent);
  color: #fff;
}

.settings-tab i {
  font-size: 0.8rem;
}

.settings-content {
  display: none;
}

.settings-content.active {
  display: block;
}

/* ============================================
   Links (Visual)
   ============================================ */

.links-visual {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-element);
  transition: all var(--transition);
}

.link-item:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.link-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-group i {
  color: var(--vk);
}

.link-channel {
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-channel i {
  color: var(--telegram);
}

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

.link-name {
  font-size: 0.875rem;
  color: var(--text-primary);
}

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

.link-delete {
  padding: 4px 8px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition);
}

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

.link-delete:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}

/* ============================================
   Posts
   ============================================ */

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  will-change: transform;
}

.post-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--telegram));
  opacity: 0;
  transition: opacity var(--transition);
}

.post-card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.post-card:hover::before {
  opacity: 1;
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.post-header span:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-meta span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.post-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.post-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: var(--radius-element);
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
}

.post-item:hover {
  background: var(--border-subtle);
  color: var(--text-primary);
}

.post-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

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

.post-source i {
  margin-right: 4px;
}

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

.telegraph-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(91, 124, 250, 0.1);
  color: var(--accent);
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
}

.post-details {
  padding: 20px;
}

.post-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.post-detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 100px;
  flex-shrink: 0;
}

.detail-value {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.detail-link {
  color: var(--accent);
  cursor: pointer;
  transition: color var(--transition);
}

.detail-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.post-text-full {
  white-space: pre-wrap;
  word-break: break-word;
}

.post-actions-details {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* ============================================
   Filters
   ============================================ */

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-element);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-family);
  transition: all var(--transition);
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a9c9' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.search-box {
  position: relative;
  flex: 1;
}

.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-family);
  transition: all var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

/* ============================================
   Badges
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-success {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.badge-danger {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

.badge-warning {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.badge-info {
  background: rgba(96, 165, 250, 0.15);
  color: var(--info);
}

/* ============================================
   Logs
   ============================================ */

.logs-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.log-item {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-element);
  font-size: 0.8rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  transition: background var(--transition);
}

.log-item:hover {
  background: var(--surface-hover);
}

.log-item.info {
  color: var(--text-secondary);
}

.log-item.warning {
  color: var(--warning);
  background: rgba(251, 191, 36, 0.05);
}

.log-item.error {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.05);
}

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

/* ============================================
   Pagination
   ============================================ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 0;
}

.page-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 0;
}

/* ============================================
   Toasts
   ============================================ */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-element);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  pointer-events: all;
  animation: toastSlide 0.3s ease;
  min-width: 300px;
  max-width: 450px;
  position: relative;
  overflow: hidden;
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.error {
  border-left: 3px solid var(--danger);
}

.toast.warning {
  border-left: 3px solid var(--warning);
}

.toast.info {
  border-left: 3px solid var(--info);
}

.toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }

.toast-content {
  flex: 1;
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.8rem;
  transition: color var(--transition);
}

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

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  animation: toast-progress 3s linear forwards;
}

@keyframes toastSlide {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-progress {
  from { width: 100%; }
  to { width: 0; }
}

/* ============================================
   Modals
   ============================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalSlide 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.modal-content.modal-lg {
  max-width: 800px;
}

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

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-element);
  font-size: 1rem;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--border-subtle);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-body .settings-tabs {
  margin-bottom: 20px;
}

.modal-body .settings-tab {
  font-size: 0.8rem;
  padding: 6px 12px;
}

.modal-body .settings-content {
  display: none;
}

.modal-body .settings-content.active {
  display: block;
}

.modal-body .form-section {
  margin-bottom: 20px;
}

.modal-body .form-section h4 {
  font-size: 0.9rem;
}

.modal-body .form-section h4 i {
  color: var(--accent);
  margin-right: 6px;
}

.modal-body .form-group {
  margin-bottom: 14px;
}

.modal-body .form-group label {
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.modal-body .form-group label i {
  margin-right: 4px;
  color: var(--text-muted);
}

.modal-body .form-group input,
.modal-body .form-group select,
.modal-body .form-group textarea {
  font-size: 0.85rem;
  padding: 8px 12px;
}

.modal-body .form-group input:focus,
.modal-body .form-group select:focus,
.modal-body .form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal-body .checkbox-group .checkmark {
  width: 18px;
  height: 18px;
}

.modal-body .checkbox-group label {
  font-size: 0.8rem;
}

.modal-body .days-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-body .days-checkbox-group .checkbox-group {
  flex: 0 0 auto;
}

.modal-body .form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
}

.modal-body .form-actions .btn {
  font-size: 0.8rem;
  padding: 8px 16px;
}

.modal-body .telegraph-settings {
  padding: 12px;
}

.modal-body .input-group {
  margin-bottom: 0;
}

.modal-body .input-group-text {
  font-size: 0.8rem;
  padding: 0 10px;
}

.modal-body .input-group .form-control {
  font-size: 0.85rem;
  padding: 8px 12px;
}

@keyframes modalSlide {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ============================================
   Upload & Import
   ============================================ */

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-card);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.upload-area:hover {
  border-color: var(--accent);
  background: rgba(91, 124, 250, 0.03);
}

.upload-area i {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.upload-area h4 {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.import-stats {
  display: flex;
  gap: 16px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.import-stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg);
  border-radius: var(--radius-element);
}

.import-stat-item i {
  color: var(--accent);
}

.import-preview {
  max-height: 200px;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-element);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  font-family: monospace;
  color: var(--text-secondary);
}

.alert-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: var(--radius-element);
  color: var(--warning);
  font-size: 0.85rem;
}

/* ============================================
   Loading & Empty States
   ============================================ */

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

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

.loading-posts {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px;
  color: var(--text-muted);
}

.loading-posts i {
  font-size: 1.5rem;
  color: var(--accent);
  animation: spin 1s linear infinite;
}

.loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  color: var(--border);
}

.no-results h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state i {
  font-size: 2.5rem;
  color: var(--border);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.error-message {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: var(--radius-element);
  color: var(--danger);
  font-size: 0.875rem;
}

.error-message i {
  font-size: 1rem;
  flex-shrink: 0;
}

.error-message button {
  margin-left: auto;
}

.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.error-container h2 {
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.skeleton-loader {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: var(--radius-element);
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   Login
   ============================================ */

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 40px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header i {
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 16px;
  display: block;
}

.login-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-form .form-group {
  margin-bottom: 18px;
}

.login-form label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

.login-form input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-element);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-family);
  transition: all var(--transition);
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-form .btn {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.login-footer a {
  color: var(--accent);
}

.login-footer a:hover {
  text-decoration: underline;
}

/* ============================================
   Settings Page
   ============================================ */

.settings-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: var(--radius-element);
  font-size: 0.85rem;
  color: var(--info);
  margin-bottom: 20px;
}

.settings-info code {
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
}

.settings-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-group {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.settings-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}

.settings-group-header i {
  color: var(--accent);
  font-size: 1rem;
}

.settings-group-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-group-body {
  padding: 20px;
}

.settings-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-field:last-child {
  border-bottom: none;
}

.settings-field label {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.settings-input {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-element);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-family);
  transition: all var(--transition);
  max-width: 300px;
}

.settings-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.settings-input[type="password"] {
  letter-spacing: 2px;
}

.settings-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

#saveSettingsBtn {
  display: flex;
  align-items: center;
  gap: 8px;
}

#saveSettingsBtn i {
  font-size: 0.85rem;
}

/* ============================================
   Utilities & Animations
   ============================================ */

.text-muted { color: var(--text-muted); }
.text-primary { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-success { color: var(--success); }
.text-center { text-align: center; }

.d-block { display: block; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.gap-2 { gap: 8px; }
.mb-4 { margin-bottom: 16px; }
.mx-2 { margin-left: 8px; margin-right: 8px; }
.mt-2 { margin-top: 8px; }

/* Animations */
.animate-slide-in {
  animation: slideIn 0.3s ease;
}

.animate-fade-in {
  animation: fadeIn 0.3s ease;
}

.animate-scale-in {
  animation: scaleIn 0.2s ease;
}

.animate-shake {
  animation: shake 0.5s ease;
}

@keyframes slideIn {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Links */
.link {
  color: var(--accent);
  cursor: pointer;
  transition: all var(--transition);
}

.link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Top Groups List */
.top-groups-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.top-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-element);
  transition: all var(--transition);
}

.top-item:hover {
  background: var(--surface-hover);
}

.top-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--border-subtle);
  color: var(--text-muted);
  flex-shrink: 0;
}

.top-item:nth-child(1) .top-rank {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.top-item:nth-child(2) .top-rank {
  background: rgba(148, 169, 201, 0.15);
  color: var(--text-secondary);
}

.top-item:nth-child(3) .top-rank {
  background: rgba(205, 127, 50, 0.15);
  color: #cd7f32;
}

.top-info {
  flex: 1;
  min-width: 0;
}

.top-name {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-name small {
  color: var(--text-muted);
  font-weight: 400;
}

.top-stats {
  display: flex;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.top-stats span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.top-percent {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width var(--transition-slow);
}

/* Days Checkbox Group */
.days-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Tooltip */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-primary);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 100;
}

[data-tooltip]:hover:before {
  opacity: 1;
}

/* Notification Badge */
.notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  border-radius: 9px;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Live Stats */
.live-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.live-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.live-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.live-stat-change {
  font-size: 0.7rem;
  font-weight: 600;
}

.live-stat-change.positive {
  color: var(--success);
}

.live-stat-change.negative {
  color: var(--danger);
}

/* Metrics Row */
.metrics-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.metric-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

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

.metric-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-unit {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Filter Count */
.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
}

/* ============================================
   Responsive
   ============================================ */

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

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }

  .sidebar.collapsed {
    width: 260px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0 !important;
  }

  .sidebar.collapsed + .main-content {
    margin-left: 0;
  }

  .content-area {
    padding: 16px;
  }

  .top-bar {
    padding: 16px;
  }

  .page-title {
    font-size: 1.2rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
    gap: 10px;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .stat-info h3 {
    font-size: 1.2rem;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .quick-actions {
    grid-template-columns: repeat(3, 1fr);
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 95%;
    max-height: 90vh;
    margin: 10px;
  }

  .login-card {
    padding: 30px 24px;
  }

  .bot-stats-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .toast-container {
    left: 10px;
    right: 10px;
  }

  .toast {
    min-width: auto;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 12px;
  }

  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .settings-field {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .settings-input {
    max-width: 100%;
    width: 100%;
  }

  .login-container {
    padding: 12px;
  }

  .login-card {
    padding: 24px 20px;
  }

  .metrics-row {
    gap: 12px;
  }

  .live-stats {
    gap: 12px;
  }
}

@media (max-width: 640px) {
  .table-responsive {
    border-radius: var(--radius-element);
  }

  .data-table thead th,
  .data-table td {
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .days-checkbox-group {
    gap: 6px;
  }

  .days-checkbox-group .checkbox-group {
    flex: 0 0 calc(50% - 3px);
  }
}

@media (min-width: 1600px) {
  .content-area {
    max-width: 1600px;
    padding: 32px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .posts-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (hover: none) {
  .link-delete {
    opacity: 1;
  }

  .post-card:hover {
    transform: none;
  }

  .stat-card:hover {
    transform: none;
  }

  .btn:hover:not(:disabled) {
    transform: none;
  }
}

@supports (padding: env(safe-area-inset-top)) {
  .app-container {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .sidebar {
    top: env(safe-area-inset-top);
  }

  .toast-container {
    top: calc(20px + env(safe-area-inset-top));
    right: calc(20px + env(safe-area-inset-right));
  }
}

@media (display-mode: standalone) {
  .sidebar {
    top: 0;
  }

  .content-area {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .toast-container {
    top: env(safe-area-inset-top);
  }
}
