@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
  --bg-primary: #080711;
  --bg-secondary: #0f0c20;
  --bg-tertiary: #191436;
  --accent-cyan: #00f2fe;
  --accent-magenta: #ff007f;
  --accent-violet: #7f00ff;
  --text-main: #f8f9fa;
  --text-muted: #8b8a9f;
  --glass-bg: rgba(15, 12, 32, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --card-bg: rgba(255, 255, 255, 0.02);
  --card-border: rgba(255, 255, 255, 0.05);
  --neon-glow: 0 0 15px rgba(127, 0, 255, 0.4);
  --font-family: 'Outfit', sans-serif;
  --grid-gap: 6px;
  --grid-col-width: 25vw;
}

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

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 10% 20%, rgba(127, 0, 255, 0.15) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(0, 242, 254, 0.1) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(255, 0, 127, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border: 2px solid var(--bg-primary);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-violet);
  box-shadow: 0 0 5px var(--accent-violet);
}

/* Floating Navigation Bar */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  padding: 12px 24px;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
  animation: pulse 2s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 10px rgba(0, 242, 254, 0.5); }
  100% { transform: scale(1.05); box-shadow: 0 0 20px rgba(255, 0, 127, 0.7); }
}

.logo-text {
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 2px;
  background: linear-gradient(to right, #fff, #a29bfe, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
}

/* Marquee */
.marquee-wrap {
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.marquee-text {
  display: inline-block;
  white-space: nowrap;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--accent-magenta), var(--accent-cyan), var(--accent-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: scrollRight 6s linear infinite;
}

@keyframes scrollRight {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Menu Actions */
.btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 12px;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease-in-out;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-magenta));
  border: none;
  box-shadow: 0 4px 15px rgba(127, 0, 255, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #9b4dff, #ff3399);
  box-shadow: 0 4px 20px rgba(255, 0, 127, 0.5);
  transform: translateY(-2px);
}

/* Main Grid Layout Container */
main {
  padding-top: 60px;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
  width: 100%;
  height: 100vh;
}

.gif-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: calc((100vh - 60px) / 3);
  gap: var(--grid-gap);
  width: 100%;
  height: calc(100vh - 60px);
  margin: 0;
  padding: var(--grid-gap);
}

/* GIF Cards Styling */
.gif-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  will-change: transform;
}

.gif-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gif-card:hover {
  transform: translateY(-5px) scale(1.02);
  z-index: 10;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(127, 0, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.2);
}

.gif-card:hover img {
  transform: scale(1.05);
}

/* Card Overlays */
.card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(15, 12, 32, 0.95) 0%, rgba(15, 12, 32, 0.6) 40%, rgba(0,0,0,0) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 15px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gif-card:hover .card-overlay {
  opacity: 1;
}

.card-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-category {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  font-weight: 600;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.8rem;
}

.card-btn:hover {
  background: var(--accent-magenta);
  transform: scale(1.1);
}

.card-btn.favorited {
  color: var(--accent-magenta);
  background: rgba(255, 0, 127, 0.2);
}

/* Filters removed */

/* Modal Windows (Glassmorphism) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 3, 10, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6), 0 0 30px rgba(127,0,255,0.2);
  position: relative;
  animation: modalScale 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}

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

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

.modal-title {
  font-weight: 800;
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--accent-magenta);
}

.modal-body {
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 650px) {
  .modal-body {
    grid-template-columns: 1.2fr 1fr;
  }
}

.modal-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.05);
}

.modal-preview img {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
}

.modal-details {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.detail-val {
  font-size: 0.95rem;
}

.detail-tag {
  display: inline-block;
  background: rgba(255,255,255,0.05);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  margin-right: 5px;
  margin-bottom: 5px;
  color: var(--text-main);
  border: 1px solid rgba(255,255,255,0.05);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Forms removed */

/* Footer removed */

/* Notifications toast */
.toast {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 10px rgba(0, 242, 254, 0.2);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(150%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateY(0);
}

.toast-icon {
  color: var(--accent-cyan);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  header {
    padding: 10px 15px;
  }
  
  main {
    padding-top: 50px;
  }

  .logo-text {
    font-size: 1.1rem;
  }
}
