/* Dashboard — Binance-style fixed layout, skeletons, modern controls */

.dashboard-page {
  font-family: 'Inter', var(--font-family);
}

.dashboard-page .card:hover {
  transform: none;
}

.dashboard-panel {
  padding: 1.75rem 2rem 2rem;
}

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  min-height: 72px;
}

.dashboard-header h1 {
  margin-bottom: 0.35rem;
  font-size: 2rem;
}

.dashboard-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.market-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(30, 35, 41, 0.9);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.market-status.live .status-dot {
  background: var(--success);
  box-shadow: 0 0 8px rgba(14, 203, 129, 0.65);
}

.market-status.error .status-dot {
  background: var(--danger);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse-dot 1.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

.dashboard-section {
  margin-bottom: 2rem;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  min-height: 28px;
}

.section-heading h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-main);
}

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

/* Market grid — fixed min heights */
.dashboard-page .widget-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 0;
  min-height: 660px;
}

@media (max-width: 1200px) {
  .dashboard-page .widget-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 990px;
  }
}

@media (max-width: 640px) {
  .dashboard-page .widget-row {
    grid-template-columns: 1fr;
    min-height: 1980px;
  }
}

.dashboard-page .price-widget {
  margin-bottom: 0;
  padding: 1rem 1.1rem 1.05rem;
  min-height: 210px;
  height: 210px;
  position: relative;
  overflow: hidden;
}

.dashboard-page .price-widget.is-loaded {
  animation: widget-in 0.35s ease-out;
}

@keyframes widget-in {
  from { opacity: 0.85; }
  to { opacity: 1; }
}

/* Skeleton — price widgets */
.price-widget-skeleton {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.price-widget-skeleton::before {
  content: '';
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  height: 52px;
  background: linear-gradient(
    90deg,
    rgba(43, 49, 57, 0.5) 0%,
    rgba(60, 68, 78, 0.65) 50%,
    rgba(43, 49, 57, 0.5) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: 6px;
}

.price-widget-skeleton::after {
  content: '';
  flex: 1;
  min-height: 100px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(43, 49, 57, 0.35) 0%,
    rgba(60, 68, 78, 0.5) 50%,
    rgba(43, 49, 57, 0.35) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  animation-delay: 0.15s;
}

.price-widget.is-loading .price-widget-body {
  display: none;
}

.price-widget:not(.is-loading) .price-widget-skeleton {
  display: none;
}

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

/* Posts section — fixed panel heights */
.posts-section.grid-2 {
  gap: 1.25rem;
  align-items: start;
}

.dashboard-card {
  margin-bottom: 0;
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  min-height: 380px;
}

.drafts-card {
  /* Removed grid-column: 1 / -1 to allow side-by-side layout with logs */
}

.card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  min-height: 36px;
  flex-shrink: 0;
}

.card-toolbar h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Buttons — dashboard variants */
.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: 6px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1.1rem;
  border-radius: 8px;
}

.dashboard-page .btn {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.dashboard-page .btn:active {
  transform: scale(0.97);
}

.dashboard-page .btn-secondary {
  border-color: rgba(252, 213, 53, 0.45);
}

.dashboard-page .btn-danger {
  background: rgba(246, 70, 93, 0.15);
  color: var(--danger);
  border: 1px solid rgba(246, 70, 93, 0.45);
}

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

/* Scroll panels — fixed height, custom scrollbar */
.scroll-panel {
  flex: 1;
  min-height: 280px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: #474d57 transparent;
}

.scroll-panel::-webkit-scrollbar {
  width: 6px;
}

.scroll-panel::-webkit-scrollbar-track {
  background: transparent;
  margin: 4px 0;
}

.scroll-panel::-webkit-scrollbar-thumb {
  background: #474d57;
  border-radius: 6px;
}

.scroll-panel::-webkit-scrollbar-thumb:hover {
  background: #5e6673;
}

.scroll-panel.is-loading .list-item {
  display: none;
}

.scroll-panel:not(.is-loading) .list-skeleton {
  display: none;
}

.scroll-panel .empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1rem 0.25rem;
}

/* List skeleton */
.list-skeleton {
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(43, 49, 57, 0.6);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.skeleton-line {
  display: block;
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgba(43, 49, 57, 0.5) 0%,
    rgba(70, 78, 88, 0.7) 50%,
    rgba(43, 49, 57, 0.5) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-55 { width: 55%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-65 { width: 65%; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-75 { width: 75%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-85 { width: 85%; }
.skeleton-line.w-88 { width: 88%; }
.skeleton-line.w-90 { width: 90%; }
.skeleton-line.w-95 { width: 95%; }

/* Post list items */
.list-item {
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(11, 14, 17, 0.35);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.list-item:hover {
  border-color: rgba(252, 213, 53, 0.2);
  background: rgba(11, 14, 17, 0.55);
}

.list-item-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.list-item-main {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
}

.list-item-body {
  min-width: 0;
}

.list-item-body strong {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.list-item-body .topic {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  word-break: break-word;
}

.list-item-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* Modern checkboxes */
.dashboard-page input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin-top: 3px;
  border: 1.5px solid #5e6673;
  border-radius: 4px;
  background: #0b0e11;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
  position: relative;
}

.dashboard-page input[type="checkbox"]:hover {
  border-color: var(--primary);
}

.dashboard-page input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.dashboard-page input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #0b0e11;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.dashboard-page input[type="checkbox"].cb-hidden {
  display: none;
}

.text-success { color: var(--success); }
.text-warning { color: var(--primary); }
.text-danger { color: var(--danger); }

@media (max-width: 900px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .main-content {
    padding: 1.25rem;
  }

  .dashboard-panel {
    padding: 1.25rem;
  }
}
