/* dashboard.css - DailyDiary Author Dashboard Stable Styles */

/* ========== BASE ========== */
html {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.sidebar-open {
  overflow: hidden;
}

/* ========== CUSTOM SCROLLBAR ========== */
.custom-scrollbar::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
  background: #475569;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Firefox scrollbar */
.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.dark .custom-scrollbar {
  scrollbar-color: #475569 transparent;
}

/* ========== LOADING ========== */
@keyframes logoPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.logo-animated {
  animation: logoPulse 2s ease-in-out infinite;
}

/* ========== SIDEBAR ========== */
#sidebar {
  will-change: transform;
  -webkit-overflow-scrolling: touch;
}

.sidebar-link {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.sidebar-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: #2563EB;
  border-radius: 0 4px 4px 0;
  transition: height 0.2s ease;
}

.sidebar-link.active::before {
  height: 60%;
}

.sidebar-link.active {
  color: #2563EB;
  font-weight: 600;
}

.sidebar-link:not(.active):hover {
  background: rgba(37, 99, 235, 0.04);
}

.dark .sidebar-link:not(.active):hover {
  background: rgba(37, 99, 235, 0.08);
}

/* ========== SIDEBAR OVERLAY ========== */
#sidebarOverlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* ========== STAT CARDS ========== */
.stat-card {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.1);
}

.dark .stat-card:hover {
  box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.3);
}

.quick-stat {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.quick-stat:hover {
  transform: translateY(-3px);
}

/* ========== TABLE STYLES ========== */
#articlesTableBody tr {
  transition: background-color 0.15s ease;
  cursor: pointer;
}

#articlesTableBody tr:hover {
  background-color: rgba(37, 99, 235, 0.03);
}

.dark #articlesTableBody tr:hover {
  background-color: rgba(37, 99, 235, 0.06);
}

#articlesTableBody tr:active {
  background-color: rgba(37, 99, 235, 0.06);
}

.status-badge {
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  display: inline-block;
  white-space: nowrap;
}

.status-published {
  background: #D1FAE5;
  color: #065F46;
}

.status-draft {
  background: #FEF3C7;
  color: #92400E;
}

.status-archived {
  background: #F1F5F9;
  color: #475569;
}

.dark .status-published {
  background: #064E3B;
  color: #A7F3D0;
}

.dark .status-draft {
  background: #78350F;
  color: #FDE68A;
}

.dark .status-archived {
  background: #1E293B;
  color: #94A3B8;
}

/* ========== DASHBOARD PAGE TRANSITIONS ========== */
.dashboard-page {
  animation: pageFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ========== TOAST ========== */
.toast {
  background: white;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.8rem;
  pointer-events: auto;
}

@media (min-width: 640px) {
  .toast {
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    font-size: 0.875rem;
  }
}

.dark .toast {
  background: #1e293b;
  color: #f1f5f9;
}

@keyframes toastSlideIn {
  from {
    transform: translateX(120px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-exit {
  opacity: 0;
  transform: translateX(120px);
  transition: all 0.3s ease;
}

/* ========== COMMENT CARDS ========== */
.comment-card {
  background: white;
  border-radius: 1rem;
  padding: 1.25rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.dark .comment-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.05);
}

.comment-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.dark .comment-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ========== TOP ARTICLES LIST ========== */
#topArticlesList > div {
  transition: all 0.15s ease;
}

#topArticlesList > div:hover {
  background-color: rgba(37, 99, 235, 0.04) !important;
  border-radius: 0.5rem;
}

.dark #topArticlesList > div:hover {
  background-color: rgba(37, 99, 235, 0.08) !important;
}

/* ========== RESPONSIVE FIXES ========== */
@media (max-width: 639px) {
  input[type="text"],
  input[type="email"],
  textarea,
  select {
    font-size: 16px !important;
  }

  button {
    min-height: 44px;
    touch-action: manipulation;
  }

  .status-badge {
    font-size: 10px;
    padding: 2px 8px;
  }

  #articlesTableBody td {
    padding: 10px 8px;
  }
}

@media (max-width: 1023px) {
  #sidebar {
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
  }
}

/* ========== SMOOTH SCROLLING FOR MAIN AREA ========== */
#mainScrollArea {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ========== FOCUS STYLES ========== */
input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: none;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  ring: 2px solid rgba(37, 99, 235, 0.3);
}

/* ========== BUTTON ACTIVE STATES ========== */
button:active {
  transform: scale(0.97);
  transition: transform 0.1s ease;
}

/* ========== STICKY TABLE HEADER ========== */
thead tr {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* ========== PREVENT LAYOUT SHIFT ========== */
img {
  max-width: 100%;
  height: auto;
}

canvas {
  max-width: 100%;
}

/* ========== PRINT STYLES ========== */
@media print {
  #sidebar,
  #sidebarOverlay,
  header,
  #toastContainer,
  #loadingScreen {
    display: none !important;
  }

  main {
    margin-left: 0 !important;
  }

  #mainScrollArea {
    overflow: visible !important;
  }
}