/* --- Reset & Variables --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #121212;
  --bg-secondary: #1e1e1e;
  --bg-hover: #2a2a2a;
  --text-main: #f0f0f0;
  --text-muted: #aaaaaa;
  --accent: #4a90e2;
  --border: #333333;
  --sidebar-width: 320px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* --- Password Overlay --- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.password-card {
  background: var(--bg-secondary);
  padding: 2.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.password-card h2 {
  margin-bottom: 0.5rem;
}

.password-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.password-card input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: #fff;
  font-size: 1rem;
  margin-bottom: 1rem;
  outline: none;
}

.password-card input:focus {
  border-color: var(--accent);
}

.password-card button {
  width: 100%;
  padding: 0.75rem;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
}

.password-card button:hover {
  opacity: 0.9;
}

.error-text {
  color: #ff5555 !important;
  margin-top: 1rem;
}

/* --- App Layout --- */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.sidebar-header .subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.album-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

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

.album-item {
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: background 0.15s;
}

.album-item:hover {
  background: var(--bg-hover);
}

.album-item.active {
  background: var(--bg-hover);
  border-left-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.album-count {
  background: #2a2a2a;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
}

/* Content Area */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content-header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-primary);
}

.content-header h2 {
  font-size: 1.3rem;
}

.photo-count {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.mobile-toggle {
  display: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}

/* Photo Grid */
.photo-grid {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-gap: 12px;
  align-content: start;
}

.photo-card {
  aspect-ratio: 1;
  background: var(--bg-secondary);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  border: 1px solid var(--border);
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
  loading: lazy;
}

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

/* Download Button styling inside Lightbox */
.gdownload-btn {
  color: #fff !important;
  background: var(--accent);
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

/* Responsive Rules */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    inset: 0;
    z-index: 100;
    width: 80%;
    max-width: 300px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-toggle {
    display: block;
  }

  .photo-grid {
    padding: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    grid-gap: 8px;
  }
}
