:root {
  --bg: #0f0f23;
  --surface: #1a1a2e;
  --accent: #6c63ff;
  --text: #e0e0e0;
  --text-muted: #888;
  --border: #2a2a4a;
  --danger: #e74c3c;
  --success: #27ae60;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.header {
  background: var(--surface);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.header nav { display: flex; gap: 1.5rem; }

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { filter: brightness(1.1); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { filter: brightness(1.1); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

/* Forms */
input, textarea, select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.form-group { margin-bottom: 1rem; }

/* Waterfall Gallery */
.gallery {
  columns: 4 280px;
  column-gap: 1rem;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 1rem;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  transition: transform 0.2s;
}

.gallery-item:hover { transform: scale(1.02); }

.gallery-item img {
  width: 100%;
  display: block;
  object-fit: cover;
}

/* Album Cards */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.album-card {
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s;
  cursor: pointer;
}

.album-card:hover { transform: translateY(-4px); }

.album-cover {
  aspect-ratio: 4/3;
  background: var(--border);
  overflow: hidden;
}

.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-info {
  padding: 1rem;
}

.album-info h3 {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.album-info p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.album-count {
  color: var(--accent);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.lightbox.active { display: flex; }

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  font-size: 2rem;
  padding: 1rem;
  cursor: pointer;
}

.lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

/* Admin Specific */
.admin-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  min-height: calc(100vh - 80px);
}

.sidebar {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 12px;
  height: fit-content;
  position: sticky;
  top: 100px;
}

.sidebar h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.album-list {
  list-style: none;
}

.album-list li {
  padding: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.album-list li:hover { background: var(--border); }
.album-list li.active { background: var(--accent); }

.album-list .delete-btn {
  opacity: 0;
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}

.album-list li:hover .delete-btn { opacity: 1; }

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 3rem;
  text-align: center;
  transition: all 0.2s;
  margin-bottom: 2rem;
}

.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(108, 99, 255, 0.1);
}

.upload-zone input[type="file"] { display: none; }

.upload-zone p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Photo Grid (Admin) */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-item .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.photo-item:hover .overlay { opacity: 1; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.active { display: flex; }

.modal-content {
  background: var(--surface);
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
}

.modal-content h2 {
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Login */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 80px);
}

.login-box {
  background: var(--surface);
  padding: 2rem;
  border-radius: 12px;
  width: 100%;
  max-width: 360px;
}

.login-box h2 {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Messages */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  color: white;
  z-index: 2000;
  animation: slideIn 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Loading */
.loading {
  display: flex;
  justify-content: center;
  padding: 3rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state svg {
  width: 80px;
  height: 80px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: static;
  }
  
  .gallery {
    columns: 2 150px;
  }
  
  .header {
    flex-direction: column;
    gap: 1rem;
  }
}

/* Lazy loading placeholder */
.gallery-item img[data-src] {
  background: var(--surface);
  min-height: 200px;
}
