/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

/* Navbar */
.navbar {
  background: #1a73e8;
  color: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.nav-links a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 0.9rem;
}
.nav-links a:hover { color: #fff; }
.nav-logout { display: inline; }

/* Container */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-primary { background: #1a73e8; color: #fff; }
.btn-primary:hover { background: #1557b0; }
.btn-danger { background: #d93025; color: #fff; }
.btn-danger:hover { background: #b3261e; }
.btn-secondary { background: #5f6368; color: #fff; }
.btn-secondary:hover { background: #4a4e51; }
.btn-success { background: #188038; color: #fff; }
.btn-success:hover { background: #13602b; }
.btn-block { display: block; width: 100%; text-align: center; }

/* Forms */
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #dadce0;
  border-radius: 6px;
  font-size: 1rem;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26,115,232,0.2);
}
.form-row {
  display: flex;
  gap: 1rem;
}
.form-row .form-group { flex: 1; }

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-error { background: #fce8e6; color: #c5221f; border: 1px solid #f5c6cb; }
.alert-success { background: #e6f4ea; color: #137333; border: 1px solid #ceead6; }
.alert-info { background: #e8f0fe; color: #1a73e8; border: 1px solid #d2e3fc; }
.alert-warning { background: #fef7e0; color: #ea8600; border: 1px solid #feefc3; }

/* Login page */
.login-page {
  max-width: 360px;
  margin: 3rem auto;
  text-align: center;
}
.login-page h1 { margin-bottom: 0.25rem; font-size: 1.8rem; }
.login-page .subtitle { color: #5f6368; margin-bottom: 2rem; }
.login-form { text-align: left; }
.login-hint { color: #5f6368; font-size: 0.85rem; margin-top: 1.5rem; }

/* Cards */
.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card h2 { font-size: 1.2rem; margin-bottom: 0.75rem; }
.card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* Stat */
.stat { font-size: 2rem; font-weight: 700; color: #1a73e8; }
.stat-label { font-size: 0.85rem; color: #5f6368; }

/* Upload zone */
.upload-zone {
  border: 2px dashed #dadce0;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 1rem;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: #1a73e8;
  background: #e8f0fe;
}
.upload-zone p { color: #5f6368; margin-top: 0.5rem; }
.upload-zone .icon { font-size: 2.5rem; }

.upload-hint {
  font-size: 0.8rem;
  color: #ea8600;
  background: #fef7e0;
  border: 1px solid #feefc3;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

/* File list */
.file-list { list-style: none; }
.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}
.file-item:last-child { border-bottom: none; }
.file-name { flex: 1; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file-size { font-size: 0.75rem; color: #80868b; white-space: nowrap; }
.file-status { font-size: 0.8rem; min-width: 80px; text-align: right; white-space: nowrap; }
.file-status.success { color: #188038; font-weight: 600; }
.file-status.error { color: #d93025; font-weight: 600; }
.file-error-detail { width: 100%; font-size: 0.75rem; color: #d93025; padding-top: 0.2rem; }
.file-item { flex-wrap: wrap; }
.file-progress {
  flex: 0 0 120px;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
}
.file-progress-bar {
  height: 100%;
  background: #1a73e8;
  border-radius: 3px;
  transition: width 0.3s;
}

/* Photo grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}
.photo-card {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.photo-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.photo-card .photo-info {
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  color: #5f6368;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-card .photo-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.photo-card:hover .photo-delete { opacity: 1; }

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: #fff;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
}

/* Progress bar */
.progress-container {
  background: #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  height: 24px;
  margin: 1rem 0;
}
.progress-bar {
  height: 100%;
  background: #1a73e8;
  transition: width 0.5s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 2rem;
}

/* Settings grid */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Bucket list */
.bucket-list {
  list-style: none;
}
.bucket-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f0f0f0;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.bucket-item:last-child { border-bottom: none; }
.bucket-name { font-weight: 600; }
.bucket-meta { font-size: 0.85rem; color: #5f6368; }

/* No bucket message */
.no-bucket {
  text-align: center;
  padding: 3rem 1rem;
}
.no-bucket h2 { color: #5f6368; margin-bottom: 0.5rem; }
.no-bucket p { color: #80868b; }

/* Responsive */
@media (max-width: 600px) {
  .container { padding: 1rem 0.75rem; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .upload-zone { padding: 1.5rem 1rem; }
  .photo-card .photo-delete { opacity: 1; }
  .bucket-item { flex-direction: column; align-items: flex-start; }
}
