/* =========================
   Modern Projects Hub CSS
   ========================= */

/* Base & Variables */
:root {
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 50%, #ddd6fe 100%);
  --card-bg: rgba(255, 255, 255, 0.8);
  --card-border: rgba(148, 163, 184, 0.1);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #6366f1 50%, #8b5cf6 100%);
  --primary-blue: #3b82f6;
  --primary-indigo: #6366f1;
  --primary-purple: #8b5cf6;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.16);
  --shadow-xl: 0 24px 64px rgba(15, 23, 42, 0.2);
  --ring: rgba(59, 130, 246, 0.3);
}

.dark {
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  --card-bg: rgba(30, 41, 59, 0.6);
  --card-border: rgba(148, 163, 184, 0.1);
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.6);
  --ring: rgba(96, 165, 250, 0.4);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Site fade-in animation */
.site-fade {
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-fade.ready {
  opacity: 1 !important;
}

/* Card Styles - Modern Glass Morphism */
.card {
  position: relative;
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-md);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  cursor: pointer;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity 0.4s ease;
}

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

.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-xl);
  border-color: rgba(59, 130, 246, 0.3);
}

.dark .card:hover {
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(96, 165, 250, 0.2);
}

/* Card image container */
.card-image-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
}

.dark .card-image-wrapper {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover .card-image-wrapper img {
  transform: scale(1.08);
}

/* Button Styles */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 14px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  z-index: 1;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.15);
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
  z-index: -1;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.5);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: rgba(148, 163, 184, 0.3);
}

.dark .btn-ghost {
  border-color: rgba(148, 163, 184, 0.2);
}

.btn-ghost:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-2px);
}

.btn img,
.btn svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.2);
  transition: all 0.2s ease;
  text-decoration: none;
}

.dark .tag {
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.25);
}

.tag:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.dark .tag:hover {
  background: rgba(96, 165, 250, 0.25);
  border-color: rgba(96, 165, 250, 0.4);
}

/* Loading Spinner */
.spinner {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.spinner span {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--primary-gradient);
  animation: bounce 1s infinite ease-in-out;
}

.spinner span:nth-child(1) {
  animation-delay: 0s;
}

.spinner span:nth-child(2) {
  animation-delay: 0.15s;
}

.spinner span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Icon Button */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.dark .icon-btn {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(148, 163, 184, 0.15);
}

.icon-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.1);
}

.dark .icon-btn:hover {
  background: rgba(96, 165, 250, 0.15);
}

/* Swiper Customization */
.swiper {
  --swiper-navigation-color: var(--primary-blue);
  --swiper-pagination-color: var(--primary-blue);
  --swiper-navigation-size: 32px;
  border-radius: 16px;
  overflow: hidden;
  background: #f1f5f9;
}

.dark .swiper {
  background: #1e293b;
}

.swiper-slide img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.swiper-button-next,
.swiper-button-prev {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.dark .swiper-button-next,
.dark .swiper-button-prev {
  background: rgba(30, 41, 59, 0.95);
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.swiper-button-next::after,
.swiper-button-prev::after {
  font-size: 16px;
  font-weight: 900;
}

.swiper-pagination-bullet {
  width: 8px;
  height: 8px;
  opacity: 0.5;
  background: var(--primary-blue);
  transition: all 0.3s ease;
}

.swiper-pagination-bullet-active {
  opacity: 1;
  width: 24px;
  border-radius: 4px;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  width: 100%;
  max-width: 1100px;
  margin: auto;
  padding: 1rem;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-container {
  transform: scale(1) translateY(0);
}

.modal-content {
  position: relative;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: 32px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 32px 96px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.dark .modal-content {
  background: rgba(15, 23, 42, 0.98);
  border-color: rgba(148, 163, 184, 0.1);
}

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-primary);
}

.dark .modal-close {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(148, 163, 184, 0.15);
}

.modal-close:hover {
  transform: rotate(90deg) scale(1.1);
  background: #ef4444;
  border-color: #ef4444;
  color: white;
}

.modal-body {
  padding: 2rem;
}

@media (min-width: 768px) {
  .modal-body {
    padding: 3rem;
  }
}

/* Modal Swiper */
.modal-swiper {
  width: 100%;
  max-height: 70vh;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  background: #f8fafc;
}

.dark .modal-swiper {
  background: #1e293b;
}

.modal-swiper .swiper {
  height: 100%;
  max-height: 70vh;
}

.modal-swiper .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  min-height: 300px;
  max-height: 70vh;
  background: #f8fafc;
}

.dark .modal-swiper .swiper-slide {
  background: #1e293b;
}

.modal-swiper .swiper-slide img {
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  object-position: center;
  display: block;
}

@media (max-width: 768px) {
  .modal-swiper {
    max-height: 50vh;
  }
  
  .modal-swiper .swiper,
  .modal-swiper .swiper-slide,
  .modal-swiper .swiper-slide img {
    max-height: 50vh;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.5);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.7);
}

.dark ::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}

.dark ::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.4);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 165, 250, 0.6);
}

/* Utility Classes */
.backdrop-blur-glass {
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.gradient-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
  .card {
    border-radius: 20px;
  }
  
  .card-image-wrapper {
    height: 180px;
  }
  
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
  }
}

/* Smooth performance */
.card,
.btn,
.tag,
.icon-btn,
.modal-overlay,
.modal-container {
  will-change: transform;
}

/* Focus states for accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .modal-overlay,
  #backToTop,
  #themeToggle {
    display: none !important;
  }
}
