/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Roboto', sans-serif;
  background: #0a0a0a;
  color: #e0e0e0;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: 'Montserrat', sans-serif; font-weight: 600; }
a { color: #0f766e; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Utilities ── */
.hidden { display: none !important; }

/* ══════════════════════════════════════════
   ADMIN STYLES
   ══════════════════════════════════════════ */

/* Admin Login */
.admin-login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: #0a0a0a;
}
.login-card {
  background: #161616; border: 1px solid #2a2a2a; border-radius: 16px;
  padding: 3rem; width: 100%; max-width: 400px; text-align: center;
}
.login-card h1 { color: #fff; font-size: 1.8rem; margin-bottom: 0.5rem; }
.login-card .subtitle { color: #888; margin-bottom: 2rem; font-size: 0.95rem; }
.login-card input {
  width: 100%; padding: 0.85rem 1rem; margin-bottom: 1rem;
  background: #1e1e1e; border: 1px solid #333; border-radius: 8px;
  color: #fff; font-size: 1rem; outline: none; transition: border-color 0.2s;
}
.login-card input:focus { border-color: #0f766e; }
.login-card .error { color: #ef4444; font-size: 0.85rem; margin-bottom: 1rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; border: none; border-radius: 8px;
  font-size: 0.95rem; font-weight: 500; transition: all 0.2s;
}
.btn-primary { background: #0f766e; color: #fff; }
.btn-primary:hover { background: #0d5a52; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: #aaa; border: 1px solid #333; }
.btn-ghost:hover { border-color: #0f766e; color: #fff; }
.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.85rem; }
.btn-full { width: 100%; justify-content: center; }

/* Admin Layout */
.admin-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem; background: #111; border-bottom: 1px solid #222;
  position: sticky; top: 0; z-index: 100;
}
.admin-header h2 { color: #fff; font-size: 1.3rem; }
.admin-header-actions { display: flex; gap: 0.75rem; align-items: center; }

/* Dashboard Grid */
.dashboard { padding: 2rem; max-width: 1400px; margin: 0 auto; }
.dashboard h1 { color: #fff; margin-bottom: 1.5rem; font-size: 2rem; }
.projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}
.project-card {
  background: #161616; border: 1px solid #2a2a2a; border-radius: 12px;
  padding: 1.5rem; transition: all 0.25s; cursor: pointer;
}
.project-card:hover { border-color: #0f766e; transform: translateY(-2px); }
.project-card h3 { color: #fff; margin-bottom: 0.5rem; }
.project-card .meta { color: #888; font-size: 0.85rem; display: flex; gap: 1rem; margin-top: 0.75rem; }
.project-card .meta span { display: flex; align-items: center; gap: 0.3rem; }
.project-card .client-name { color: #0f766e; font-weight: 500; }

/* Create Project Card */
.create-card {
  background: transparent; border: 2px dashed #333; border-radius: 12px;
  padding: 1.5rem; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 0.75rem; cursor: pointer; transition: all 0.2s;
  min-height: 160px; color: #666;
}
.create-card:hover { border-color: #0f766e; color: #0f766e; }
.create-card i { font-size: 2rem; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; backdrop-filter: blur(4px);
}
.modal {
  background: #161616; border: 1px solid #2a2a2a; border-radius: 16px;
  padding: 2rem; width: 90%; max-width: 500px;
}
.modal h2 { color: #fff; margin-bottom: 1.5rem; }
.modal label { display: block; color: #aaa; font-size: 0.85rem; margin-bottom: 0.3rem; margin-top: 1rem; }
.modal input, .modal select {
  width: 100%; padding: 0.75rem 1rem; background: #1e1e1e;
  border: 1px solid #333; border-radius: 8px; color: #fff; font-size: 0.95rem;
}
.modal input:focus { border-color: #0f766e; outline: none; }
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; justify-content: flex-end; }
.toggle-row {
  display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem;
}
.toggle-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: #0f766e; }

/* Project Detail (Admin) */
.project-detail { padding: 2rem; max-width: 1400px; margin: 0 auto; }
.project-detail-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.project-detail-header h1 { color: #fff; }
.project-detail-header .client { color: #0f766e; font-size: 1.1rem; }
.share-link-box {
  display: flex; align-items: center; gap: 0.5rem; background: #1e1e1e;
  border: 1px solid #333; border-radius: 8px; padding: 0.5rem 0.75rem;
  font-size: 0.85rem; color: #aaa; max-width: 100%; overflow: hidden;
}
.share-link-box code { color: #0f766e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Upload Zone */
.upload-zone {
  border: 2px dashed #333; border-radius: 12px; padding: 2rem;
  text-align: center; color: #666; transition: all 0.2s; margin-bottom: 2rem;
  cursor: pointer;
}
.upload-zone.drag-over { border-color: #0f766e; color: #0f766e; background: rgba(15,118,110,0.05); }
.upload-zone i { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }
.upload-zone input { display: none; }
.upload-progress { margin: 1rem 0; }
.upload-progress .bar { height: 4px; background: #222; border-radius: 4px; overflow: hidden; }
.upload-progress .bar-fill { height: 100%; background: #0f766e; transition: width 0.3s; }

/* Admin Image Grid */
.admin-images {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.admin-image-card {
  position: relative; border-radius: 10px; overflow: hidden;
  aspect-ratio: 1; background: #161616; border: 1px solid #2a2a2a;
}
.admin-image-card img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.admin-image-card .overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.5);
  opacity: 0; transition: opacity 0.2s; display: flex;
  align-items: flex-start; justify-content: flex-end; padding: 0.5rem; gap: 0.3rem;
}
.admin-image-card:hover .overlay { opacity: 1; }
.admin-image-card .overlay button {
  width: 32px; height: 32px; border-radius: 6px; border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; transition: all 0.15s;
}
.admin-image-card .star-btn { background: rgba(255,255,255,0.15); color: #aaa; }
.admin-image-card .star-btn.active { color: #fbbf24; }
.admin-image-card .del-btn { background: rgba(239,68,68,0.8); color: #fff; }
.featured-badge {
  position: absolute; top: 0.5rem; left: 0.5rem;
  background: rgba(251,191,36,0.9); color: #000; font-size: 0.7rem;
  padding: 0.2rem 0.5rem; border-radius: 4px; font-weight: 600;
}

/* ══════════════════════════════════════════
   GALLERY STYLES (CLIENT VIEW)
   ══════════════════════════════════════════ */

/* Password Screen */
.password-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: #0a0a0a;
}
.password-card {
  background: #161616; border: 1px solid #2a2a2a; border-radius: 16px;
  padding: 3rem; text-align: center; max-width: 420px; width: 90%;
}
.password-card h1 { color: #fff; font-size: 1.6rem; margin-bottom: 0.3rem; }
.password-card .sub { color: #888; margin-bottom: 2rem; }
.password-card input {
  width: 100%; padding: 0.85rem 1rem; background: #1e1e1e;
  border: 1px solid #333; border-radius: 8px; color: #fff;
  font-size: 1rem; margin-bottom: 1rem;
}
.password-card input:focus { border-color: #0f766e; outline: none; }
.password-card .error { color: #ef4444; font-size: 0.85rem; margin-bottom: 1rem; }

/* Gallery Header */
.gallery-header {
  position: sticky; top: 0; z-index: 100; background: rgba(10,10,10,0.92);
  backdrop-filter: blur(12px); border-bottom: 1px solid #1a1a1a;
  padding: 1rem 2rem; display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}
.gallery-header-left h1 { color: #fff; font-size: 1.4rem; }
.gallery-header-left .client { color: #0f766e; font-size: 0.9rem; }
.gallery-header-right { display: flex; gap: 0.75rem; }

/* Featured Section */
.featured-section { padding: 2rem 2rem 0; max-width: 1600px; margin: 0 auto; }
.featured-label {
  color: #fbbf24; font-size: 0.85rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.featured-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1rem;
}

/* Masonry Gallery */
.gallery-masonry {
  padding: 2rem; max-width: 1600px; margin: 0 auto;
  columns: 4 300px; column-gap: 1rem;
}

/* Gallery Tile */
.gallery-tile {
  break-inside: avoid; margin-bottom: 1rem; position: relative;
  border-radius: 10px; overflow: hidden; background: #161616;
  transform-style: preserve-3d; transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}
.gallery-tile img {
  width: 100%; display: block; opacity: 0;
  transition: opacity 0.6s ease;
}
.gallery-tile img.loaded { opacity: 1; }
.gallery-tile.featured-tile { border: 2px solid rgba(251,191,36,0.5); }

.gallery-tile .tile-actions {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  padding: 2rem 0.75rem 0.75rem; display: flex; align-items: flex-end;
  justify-content: flex-end; gap: 0.5rem; opacity: 0;
  transition: opacity 0.25s;
}
.gallery-tile:hover .tile-actions { opacity: 1; }
.tile-actions button {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.15); color: #fff; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); transition: background 0.2s;
}
.tile-actions button:hover { background: rgba(255,255,255,0.3); }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92);
  backdrop-filter: blur(16px); z-index: 300; display: flex;
  align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.lightbox.active { opacity: 1; pointer-events: all; }
.lightbox img {
  max-width: 90vw; max-height: 85vh; object-fit: contain;
  border-radius: 4px;
}
.lightbox-close {
  position: absolute; top: 1.5rem; right: 1.5rem;
  background: rgba(255,255,255,0.1); color: #fff; border: none;
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.1); color: #fff; border: none;
  width: 50px; height: 50px; border-radius: 50%; font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background 0.2s;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }
.lightbox-info {
  position: absolute; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 1rem; color: #ccc; font-size: 0.9rem;
}
.lightbox-info .btn { font-size: 0.85rem; }

/* ══════════════════════════════════════════
   MONTAGE / SLIDESHOW
   ══════════════════════════════════════════ */
.montage {
  position: fixed; inset: 0; background: #000; z-index: 400;
  display: flex; align-items: center; justify-content: center;
}
.montage img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; opacity: 0;
  transition: opacity 1s ease-in-out;
}
.montage img.active { opacity: 1; }
.montage-controls {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 1rem; z-index: 410;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
  padding: 0.6rem 1.2rem; border-radius: 40px;
}
.montage-controls button {
  background: transparent; border: none; color: #fff;
  font-size: 1.1rem; cursor: pointer; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: background 0.2s;
}
.montage-controls button:hover { background: rgba(255,255,255,0.15); }
.montage-counter { color: #aaa; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.montage-progress {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: #222;
}
.montage-progress-fill { height: 100%; background: #0f766e; transition: width 0.3s; }
.montage-exit {
  position: absolute; top: 1.5rem; right: 1.5rem; z-index: 410;
  background: rgba(255,255,255,0.1); border: none; color: #fff;
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* ── Loading ── */
.loading-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; color: #666;
}
.spinner {
  width: 40px; height: 40px; border: 3px solid #333;
  border-top-color: #0f766e; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Not Found ── */
.not-found {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100vh; color: #666; gap: 1rem;
}
.not-found h1 { color: #fff; font-size: 4rem; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .gallery-masonry { columns: 2 160px; padding: 1rem; }
  .featured-grid { grid-template-columns: 1fr; }
  .gallery-header { padding: 0.75rem 1rem; }
  .gallery-header-left h1 { font-size: 1.1rem; }
  .admin-images { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .projects-grid { grid-template-columns: 1fr; }
  .project-detail-header { flex-direction: column; }
  .lightbox-nav { width: 40px; height: 40px; font-size: 1rem; }
  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
}
@media (max-width: 480px) {
  .gallery-masonry { columns: 1; }
  .dashboard { padding: 1rem; }
  .project-detail { padding: 1rem; }
}
