:root {
  --bg-color: #0f172a;           /* Deep slate */
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #3b82f6;             /* Modern blue */
  --accent-hover: #2563eb;
  --error: #ef4444;
  --success: #10b981;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --border-radius: 12px;
  --transition: all 0.2s ease-in-out;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Dynamic Animated Background */
.bg-shape {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.5;
  animation: float 20s infinite ease-in-out alternate;
}
.bg-shape-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59,130,246,0.4) 0%, rgba(0,0,0,0) 70%);
  top: -100px;
  left: -100px;
}
.bg-shape-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139,92,246,0.3) 0%, rgba(0,0,0,0) 70%);
  bottom: -200px;
  right: -100px;
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0); }
  100% { transform: translate(30px, 50px); }
}

/* Glassmorphism Utilities */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--border-radius);
}

/* View Toggling */
.view {
  display: none;
  width: 100%;
  min-height: 100vh;
}
.view.active {
  display: flex;
}
.hidden {
  display: none !important;
}

/* Auth View */
#auth-view {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  max-width: 400px;
  min-height: auto;
  margin: auto;
  margin-top: 15vh;
  padding: 3rem;
  animation: fadeIn 0.4s ease-out;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-icon {
  width: 48px;
  height: 48px;
  color: var(--accent);
  margin-bottom: 1rem;
}
.auth-header h1 {
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

/* Forms & Inputs */
.input-group {
  margin-bottom: 1.5rem;
  width: 100%;
}
.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
input[type="password"],
input[type="text"],
input[type="number"],
input[type="date"],
select.glass-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 1rem;
  transition: var(--transition);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  font-family: var(--font-family);
  transition: var(--transition);
}
.primary-btn {
  width: 100%;
  padding: 0.875rem;
  background: var(--accent);
  color: white;
  font-weight: 600;
  border-radius: 8px;
  font-size: 1rem;
}
.primary-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.icon-btn {
  background: transparent;
  color: var(--text-muted);
  width: 44px;
  height: 44px;
  border-radius: 8px;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.error-text {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 1rem;
  text-align: center;
  min-height: 1.2rem;
}

/* App View */
#app-view {
  flex-direction: column;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1.25rem;
}
.brand-icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
}
.controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.control-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.control-group label {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.control-group input, .control-group select {
  padding: 0.5rem 0.75rem;
  width: auto;
}

/* Main Content */
.app-content {
  flex: 1;
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Timeline Grid */
.timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

/* Image Card */
.image-card {
  position: relative;
  border-radius: var(--border-radius);
  overflow: hidden;
  cursor: zoom-in;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--glass-border);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  aspect-ratio: 16 / 9;
}
.image-card:hover {
  transform: scale(1.02) translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}
.image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.image-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}
.time-badge {
  font-weight: 600;
  font-size: 0.875rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.size-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Loading & Empty States */
.empty-state, .loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  color: var(--text-muted);
}
.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.5;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  animation: fadeIn 0.3s ease-out;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}
.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}
.btn-close:hover {
  color: var(--text-main);
}
.info-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.4;
  padding: 0.75rem;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.2);
}
.modal-actions {
  margin-top: 2rem;
}
.status-text {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  text-align: center;
  min-height: 1.2rem;
}
.status-text.success { color: var(--success); }
.status-text.error { color: var(--error); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2.5rem;
}
.lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}
.lightbox-info {
  position: absolute;
  bottom: 2rem;
  background: var(--glass-bg);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
}

/* Responsive */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  .controls {
    flex-wrap: wrap;
    justify-content: center;
  }
  .timeline-grid {
    grid-template-columns: 1fr;
  }
  .app-content {
    padding: 1rem;
  }
}
