/* Valentines Photo Library - Mobile First, Valentine theme */

:root {
  --valentine-primary: #ff4d6d;
  --valentine-secondary: #ff758f;
  --valentine-bg: #fff0f3;
  --valentine-dark: #1f1f1f;
  --valentine-white: #ffffff;
  --shadow-soft: 0 4px 20px rgba(255, 77, 109, 0.15);
  --shadow-fab: 0 6px 24px rgba(255, 77, 109, 0.35);
  --radius: 12px;
  --radius-fab: 50%;
  --transition: 0.3s ease;
  --font: system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--valentine-bg);
  color: var(--valentine-dark);
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  vertical-align: middle;
}

a {
  color: var(--valentine-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ========== INDEX - Anasayfa ========== */

.page-index {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.page-index .header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 1rem 1.25rem;
  background: linear-gradient(to bottom, var(--valentine-bg) 60%, transparent);
  text-align: center;
}

.page-index .header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--valentine-dark);
  letter-spacing: 0.02em;
}

/* Sonsuz akan galeri container */
.gallery-wrapper {
  flex: 1;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.gallery-stream {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 0.75rem 6rem;
  animation: streamDown 80s linear infinite;
  will-change: transform;
}

.gallery-stream .stream-copy {
  flex-shrink: 0;
}

@keyframes streamDown {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

.gallery-stream .stream-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.gallery-grid {
  display: grid;
  gap: 0.5rem;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 0 0.25rem;
}

/* 2 kolon mobil (varsayılan) */
.gallery-grid { grid-template-columns: repeat(2, 1fr); }

@media (min-width: 481px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); max-width: 720px; }
}

@media (min-width: 769px) {
  .gallery-grid { grid-template-columns: repeat(4, 1fr); max-width: 960px; }
}

.gallery-item {
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--valentine-secondary);
  opacity: 0.95;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  loading: lazy;
}

/* Boş durum */
.empty-state {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  padding: 2rem;
  color: var(--valentine-dark);
  z-index: 5;
}

.empty-state p {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  opacity: 0.85;
}

/* Kalp FAB */
.fab-heart {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%);
  z-index: 30;
  width: 64px;
  height: 64px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fabPulse 2.5s ease-in-out infinite;
}

.fab-heart::before,
.fab-heart::after {
  content: "";
  position: absolute;
  width: 32px;
  height: 32px;
  background: var(--valentine-primary);
  border-radius: 50% 50% 50% 0;
  top: 50%;
  left: 50%;
}

.fab-heart::before {
  transform: translate(-100%, -50%) rotate(-45deg);
  border-radius: 50% 50% 0 50%;
}

.fab-heart::after {
  transform: translate(0, -50%) rotate(45deg);
  border-radius: 50% 50% 50% 0;
}

.fab-heart .fab-plus {
  position: relative;
  z-index: 2;
  color: var(--valentine-white);
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

@keyframes fabPulse {
  0%, 100% { filter: drop-shadow(0 6px 20px rgba(255, 77, 109, 0.4)); }
  50% { filter: drop-shadow(0 8px 28px rgba(255, 77, 109, 0.55)); }
}

.fab-heart:hover {
  transform: translateX(-50%) scale(1.05);
}

.fab-heart:active {
  transform: translateX(-50%) scale(0.98);
}

/* Upload Modal / Bottom-sheet */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 31, 31, 0.5);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

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

.modal-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 101;
  background: var(--valentine-white);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.5rem 1.25rem 2rem;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--transition);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.12);
}

.modal-overlay.is-open .modal-sheet {
  transform: translateY(0);
}

.modal-sheet h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: var(--valentine-dark);
}

.upload-zone {
  border: 2px dashed var(--valentine-secondary);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  background: var(--valentine-bg);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--valentine-primary);
  background: rgba(255, 77, 109, 0.08);
}

.upload-zone input[type="file"] {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.upload-zone .upload-text {
  color: var(--valentine-dark);
  font-size: 0.9rem;
}

.upload-zone .upload-hint {
  color: var(--valentine-secondary);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.upload-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.btn {
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  border: none;
  font-family: var(--font);
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}

.btn-primary {
  background: var(--valentine-primary);
  color: var(--valentine-white);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--valentine-bg);
  color: var(--valentine-dark);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--valentine-bg);
  border-radius: var(--radius-fab);
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--valentine-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 5rem;
  transform: translate(-50%, 80px);
  z-index: 200;
  background: var(--valentine-dark);
  color: var(--valentine-white);
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.35s ease, opacity 0.35s ease, visibility 0.35s;
  box-shadow: var(--shadow-soft);
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
  visibility: visible;
}

.toast.toast-error {
  background: #c62828;
}

/* ========== LIBRARY - Kütüphane sayfası ========== */

.page-library {
  min-height: 100vh;
  padding: 1rem 1.25rem 2rem;
}

.page-library .header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.page-library .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--valentine-primary);
  font-size: 0.95rem;
  font-weight: 500;
}

.page-library .back-link:hover {
  text-decoration: none;
  opacity: 0.9;
}

.page-library h1 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--valentine-dark);
}

.library-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(2, 1fr);
  max-width: 1200px;
  margin: 0 auto;
}

@media (min-width: 481px) {
  .library-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 769px) {
  .library-grid { grid-template-columns: repeat(4, 1fr); }
}

.library-item {
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--valentine-secondary);
  cursor: pointer;
}

.library-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  loading: lazy;
}

.library-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--valentine-dark);
  opacity: 0.85;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(31, 31, 31, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow-fab);
}

.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: var(--valentine-white);
  border-radius: var(--radius-fab);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 301;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.25);
}

/* Opsiyonel silme - library'de */
.library-item-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem;
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.library-item {
  position: relative;
}

.library-item:hover .library-item-actions {
  opacity: 1;
}

.btn-delete {
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  background: rgba(198, 40, 40, 0.9);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.btn-delete:hover {
  background: #b71c1c;
}
