/* Custom CSS cho Blog Cá Nhân */

/* CSS Variables cho Dark Mode */
:root {
  --primary-50: #eff6ff;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
}

/* Smooth Transitions */
* {
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 300ms;
}

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

::-webkit-scrollbar-track {
  @apply bg-slate-100 dark:bg-gray-800;
}

::-webkit-scrollbar-thumb {
  @apply bg-slate-400 dark:bg-gray-600 rounded-full;
}

::-webkit-scrollbar-thumb:hover {
  @apply bg-slate-500 dark:bg-gray-500;
}

/* Custom Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* Animation Classes */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

.animate-slide-up {
  animation: slideUp 0.5s ease-out;
}

.animate-slide-down {
  animation: slideDown 0.3s ease-out;
}

.animate-bounce-in {
  animation: bounceIn 0.6s ease-out;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Glass Effect */
.glass-effect {
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  background-color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(209, 213, 219, 0.3);
}

.dark .glass-effect {
  background-color: rgba(17, 24, 39, 0.75);
  border: 1px solid rgba(75, 85, 99, 0.3);
}

/* Custom Button Styles */
.btn-primary {
  @apply inline-flex items-center px-6 py-3 bg-gradient-to-r from-primary-600 to-purple-600 hover:from-primary-700 hover:to-purple-700 text-white font-semibold rounded-lg shadow-lg hover:shadow-xl transform hover:-translate-y-1 transition-all duration-300;
}

.btn-secondary {
  @apply inline-flex items-center px-6 py-3 bg-white dark:bg-gray-800 text-slate-700 dark:text-slate-300 font-semibold rounded-lg border-2 border-slate-200 dark:border-gray-700 hover:border-primary-500 dark:hover:border-primary-500 shadow-lg hover:shadow-xl transform hover:-translate-y-1 transition-all duration-300;
}

/* Card Hover Effects */
.card-hover {
  @apply transform transition-all duration-300 hover:-translate-y-2 hover:shadow-xl;
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

.dark .skeleton {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
}

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

/* Text Clamp Utilities */
.line-clamp-1 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.line-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.line-clamp-3 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* Form Styles */
.form-input {
  @apply w-full px-4 py-3 rounded-lg border border-slate-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-slate-800 dark:text-white placeholder-slate-500 dark:placeholder-gray-400 focus:ring-2 focus:ring-primary-500 focus:border-transparent outline-none transition-all;
}

.form-textarea {
  @apply w-full px-4 py-3 rounded-lg border border-slate-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-slate-800 dark:text-white placeholder-slate-500 dark:placeholder-gray-400 focus:ring-2 focus:ring-primary-500 focus:border-transparent outline-none transition-all resize-none;
}

/* Progress Bar */
.progress-bar {
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
  transform-origin: left;
  transition: transform 0.3s ease;
}

/* Social Share Buttons */
.social-btn {
  @apply inline-flex items-center justify-center w-10 h-10 rounded-full text-white transition-all duration-300 hover:scale-110 hover:shadow-lg;
}

.social-btn.facebook {
  @apply bg-blue-600 hover:bg-blue-700;
}

.social-btn.twitter {
  @apply bg-sky-500 hover:bg-sky-600;
}

.social-btn.linkedin {
  @apply bg-blue-700 hover:bg-blue-800;
}

.social-btn.copy {
  @apply bg-slate-600 hover:bg-slate-700 dark:bg-gray-600 dark:hover:bg-gray-700;
}

/* Reading Progress */
#reading-progress {
  width: 0%;
  transition: width 0.3s ease;
}

/* Mobile Menu Animation */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

#mobile-menu.show {
  max-height: 300px;
}

/* Back to Top Button */
#back-to-top {
  transition: all 0.3s ease;
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
}

/* Notification */
.notification-enter {
  transform: translateX(100%);
}

.notification-enter-active {
  transform: translateX(0);
  transition: transform 0.3s ease;
}

.notification-exit {
  transform: translateX(0);
}

.notification-exit-active {
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

/* FAQ Accordion */
.faq-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-content.open {
  max-height: 200px;
}

/* Comment Form */
.comment-form {
  @apply bg-slate-50 dark:bg-gray-800 p-6 rounded-lg border border-slate-200 dark:border-gray-700;
}

/* Code Syntax Highlighting */
pre {
  @apply bg-slate-900 text-slate-100 p-4 rounded-lg overflow-x-auto;
}

code {
  @apply bg-slate-100 dark:bg-gray-800 text-slate-800 dark:text-slate-200 px-2 py-1 rounded text-sm;
}

pre code {
  @apply bg-transparent text-slate-100 p-0;
}

/* Blockquote */
blockquote {
  @apply border-l-4 border-primary-500 pl-4 italic text-slate-600 dark:text-slate-400 my-4;
}

/* Table Styles */
table {
  @apply w-full border-collapse border border-slate-300 dark:border-gray-600;
}

th, td {
  @apply border border-slate-300 dark:border-gray-600 px-4 py-2 text-left;
}

th {
  @apply bg-slate-100 dark:bg-gray-800 font-semibold;
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .bg-gradient-to-r,
  .bg-gradient-to-br {
    background: #3b82f6 !important;
  }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus Styles */
.focus-visible:focus {
  @apply ring-2 ring-primary-500 ring-offset-2 outline-none;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .text-slate-600 {
    @apply text-slate-800;
  }
  
  .text-slate-400 {
    @apply text-slate-600;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Custom Utilities */
.text-balance {
  text-wrap: balance;
}

.content-visibility-auto {
  content-visibility: auto;
  contain-intrinsic-size: 0 500px;
}

/* Hover Effects */
.hover-lift {
  @apply transform transition-all duration-300 hover:-translate-y-1 hover:shadow-lg;
}

.hover-glow {
  @apply transition-all duration-300 hover:shadow-lg hover:shadow-primary-500/25;
}

/* Gradient Backgrounds */
.gradient-bg-1 {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-bg-2 {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.gradient-bg-3 {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* Loading States */
.loading {
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Custom Scrollbar for Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #f1f5f9;
}

html.dark {
  scrollbar-color: #6b7280 #1f2937;
}

/* Selection */
::selection {
  background-color: #3b82f6;
  color: white;
}

::-moz-selection {
  background-color: #3b82f6;
  color: white;
}

/* Avatar Gradient Animation */
@keyframes spin-slow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-spin-slow {
  animation: spin-slow 8s linear infinite;
}
