/* ============================================
   Google Photos Viewer - Stylesheet
   Google Photos Material Design style
   ============================================ */

:root {
  --google-blue: #1a73e8;
  --google-blue-dark: #1557b0;
  --google-red: #ea4335;
  --google-yellow: #fbbc04;
  --google-green: #34a853;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f4;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-tertiary: #80868b;
  --border-color: #dadce0;
  --shadow-1: 0 1px 2px 0 rgba(60, 64, 67, 0.1), 0 1px 3px 1px rgba(60, 64, 67, 0.08);
  --shadow-2: 0 1px 2px 0 rgba(60, 64, 67, 0.15), 0 2px 6px 2px rgba(60, 64, 67, 0.1);
  --shadow-3: 0 4px 8px 3px rgba(60, 64, 67, 0.1), 0 1px 3px 0 rgba(60, 64, 67, 0.1);
  --header-height: 64px;
  --sidebar-width: 256px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-medium: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 8px;
  --border-radius-sm: 4px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* ============================================
   Header
   ============================================ */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  transition: box-shadow var(--transition-fast);
}

.header.scrolled {
  box-shadow: var(--shadow-1);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 200px;
}

.header-right {
  justify-content: flex-end;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  flex-shrink: 0;
}

.logo-text {
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.menu-btn {
  display: none;
}

/* ============================================
   Icon Buttons
   ============================================ */

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background-color var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.icon-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.icon-btn:active {
  background-color: #e0e2e5;
}

/* ============================================
   Search Bar
   ============================================ */

.search-bar {
  width: 100%;
  max-width: 720px;
  height: 48px;
  background-color: var(--bg-tertiary);
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-bar:focus-within {
  background-color: var(--bg-primary);
  box-shadow: var(--shadow-1);
}

.search-icon {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.search-bar input {
  flex: 1;
  height: 100%;
  border: none;
  background: transparent;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
}

.search-bar input::placeholder {
  color: var(--text-tertiary);
}

.search-close {
  width: 32px;
  height: 32px;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background-color: var(--bg-primary);
  padding: 8px 8px;
  overflow-y: auto;
  z-index: 90;
  transition: transform var(--transition-medium);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px 0 24px;
  height: 48px;
  border-radius: 0 24px 24px 0;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.nav-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-item.active {
  background-color: #e8f0fe;
  color: var(--google-blue);
}

.sidebar-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 8px 24px;
}

.nav-item.active:hover {
  background-color: #d2e3fc;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 85;
  opacity: 0;
  transition: opacity var(--transition-medium);
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 24px 32px;
  min-height: calc(100vh - var(--header-height));
  background-color: var(--bg-primary);
}

.view {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  margin-bottom: 24px;
}

.view-title {
  font-size: 32px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.album-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.album-info {
  flex: 1;
}

.album-count {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.back-btn {
  width: 48px;
  height: 48px;
}

/* ============================================
   Album Grid
   ============================================ */

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.album-card {
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
  color: inherit;
  display: block;
}

.album-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.album-cover {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  overflow: hidden;
  background-color: var(--bg-tertiary);
  border-radius: var(--border-radius);
}

.album-cover img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-medium);
}

.album-card:hover .album-cover img {
  transform: scale(1.03);
}

.album-card-info {
  padding: 12px 4px;
}

.album-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-card-count {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ============================================
   Photo Grid (Masonry-like)
   ============================================ */

.photo-grid {
  column-count: 5;
  column-gap: 4px;
}

.photo-item {
  break-inside: avoid;
  margin-bottom: 4px;
  position: relative;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
  background-color: var(--bg-tertiary);
}

.photo-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform var(--transition-medium), opacity 0.2s ease;
  opacity: 0;
}

.photo-item img.loaded {
  opacity: 1;
}

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

.photo-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(0, 0, 0, 0.3));
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

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

.photo-favorite-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  color: #fff;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 1;
}

.photo-item:hover .photo-favorite-badge {
  opacity: 1;
}

.photo-favorite-badge svg {
  width: 20px;
  height: 20px;
  fill: var(--google-red);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.photo-video-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 4px;
  color: white;
  font-size: 11px;
  font-weight: 500;
  z-index: 1;
  backdrop-filter: blur(4px);
}

.photo-video-badge svg {
  flex-shrink: 0;
}

.photo-duration {
  white-space: nowrap;
}

/* Date section headers in photo grid */

.date-section {
  column-span: all;
  margin: 24px 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   Loading State
   ============================================ */

.loading-state,
.error-state,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  text-align: center;
}

.loading-state p,
.error-state p,
.empty-state p {
  margin-top: 16px;
  font-size: 14px;
}

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

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

/* ============================================
   Buttons
   ============================================ */

.btn-primary,
.btn-outline {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 24px;
  border-radius: 24px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  letter-spacing: 0.25px;
}

.btn-primary {
  background-color: var(--google-blue);
  color: white;
}

.btn-primary:hover {
  background-color: var(--google-blue-dark);
  box-shadow: 0 1px 2px 0 rgba(26, 115, 232, 0.3);
}

.btn-outline {
  background-color: transparent;
  color: var(--google-blue);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background-color: #e8f0fe;
  border-color: var(--google-blue);
}

.load-more-container {
  display: flex;
  justify-content: center;
  padding: 32px 0;
}

/* ============================================
   Lightbox / Photo Viewer
   ============================================ */

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-medium), visibility var(--transition-medium);
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
  z-index: 10;
  color: white;
}

.lightbox-close {
  color: white;
}

.lightbox-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.lightbox-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.lightbox-counter {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.87);
}

.lightbox-title {
  font-size: 16px;
  font-weight: 500;
  color: white;
  max-width: 400px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-actions {
  display: flex;
  gap: 8px;
}

.lightbox-actions .icon-btn {
  color: white;
}

.lightbox-actions .icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.live-photo-btn {
  width: auto !important;
  padding: 0 12px !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.15) !important;
}

.live-photo-btn:hover {
  background: rgba(255, 255, 255, 0.25) !important;
}

.live-photo-btn.active {
  background: var(--google-red) !important;
}

.live-badge {
  font-size: 11px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Live photo overlay video */
.live-photo-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.live-photo-overlay.playing {
  opacity: 1;
}

.lightbox-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 80px;
  overflow: hidden;
  position: relative;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-content video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  outline: none;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border: none;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: background-color var(--transition-fast);
  z-index: 10;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.15);
}

.lightbox-prev {
  left: 16px;
}

.lightbox-next {
  right: 16px;
}

.lightbox-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 24px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
  color: white;
  z-index: 10;
}

.lightbox-description {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.87);
  text-align: center;
  margin: 0 0 8px 0;
}

.lightbox-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.lightbox-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============================================
   Search Results
   ============================================ */

.search-query {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.search-query strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Large tablets / small laptops */
@media (max-width: 1200px) {
  .photo-grid {
    column-count: 4;
  }
}

/* Tablets */
@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-3);
  }

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

  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .menu-btn {
    display: flex;
  }

  .header-left,
  .header-right {
    min-width: auto;
  }

  .photo-grid {
    column-count: 3;
  }

  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
  }

  .view-title {
    font-size: 28px;
  }

  .lightbox-content {
    padding: 64px 56px;
  }

  .lightbox-nav {
    width: 48px;
    height: 48px;
  }
}

/* Large phones */
@media (max-width: 600px) {
  .header {
    padding: 0 8px;
  }

  .logo-text {
    display: none;
  }

  .search-bar {
    height: 44px;
  }

  .search-bar input {
    font-size: 14px;
  }

  .main-content {
    padding: 16px 12px;
  }

  .photo-grid {
    column-count: 2;
    column-gap: 3px;
  }

  .photo-item {
    margin-bottom: 3px;
  }

  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  .view-title {
    font-size: 24px;
  }

  .view-header {
    margin-bottom: 16px;
  }

  .lightbox-content {
    padding: 56px 16px;
  }

  .lightbox-nav {
    width: 40px;
    height: 40px;
  }

  .lightbox-prev {
    left: 8px;
  }

  .lightbox-next {
    right: 8px;
  }

  .lightbox-header {
    height: 56px;
    padding: 0 8px;
  }

  .lightbox-title {
    max-width: 200px;
    font-size: 14px;
  }

  .lightbox-footer {
    padding: 12px 16px;
  }
}

/* Small phones */
@media (max-width: 360px) {
  .album-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   Scrollbar styling
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #dadce0;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #bdc1c6;
}

/* ============================================
   Skeleton loading
   ============================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    #e8eaed 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-album {
  width: 100%;
  padding-bottom: 100%;
  border-radius: var(--border-radius);
}

.skeleton-photo {
  width: 100%;
  aspect-ratio: auto;
  min-height: 150px;
  border-radius: 4px;
}

/* ============================================
   Utility classes
   ============================================ */

.text-center {
  text-align: center;
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}

/* ============================================
   Sync Indicator
   ============================================ */

.sync-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--google-green);
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.sync-indicator.syncing {
  animation: spin 1s linear infinite;
  color: var(--google-blue);
  opacity: 1;
}

.sync-indicator:hover {
  opacity: 1;
}

/* ============================================
   Modal
   ============================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s ease;
}

.modal-content {
  position: relative;
  background: var(--bg-primary);
  border-radius: 12px;
  box-shadow: var(--shadow-3);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease;
  overflow: hidden;
}

.modal-sm {
  max-width: 400px;
}

.modal-lg {
  max-width: 640px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
}

/* ============================================
   Form Elements
   ============================================ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--google-blue);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.form-input[readonly] {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ============================================
   Upload Area
   ============================================ */

.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--google-blue);
  background-color: #e8f0fe;
  color: var(--google-blue);
}

.upload-area svg {
  margin-bottom: 12px;
  opacity: 0.6;
}

.upload-area p {
  margin: 4px 0;
  font-size: 14px;
}

.upload-hint {
  font-size: 12px !important;
  color: var(--text-tertiary);
}

.upload-preview {
  margin-top: 16px;
}

.upload-count {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.upload-progress {
  margin-top: 12px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background-color: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--google-blue), #4285f4);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  text-align: center;
}

/* ============================================
   Delete Warning
   ============================================ */

.delete-warning {
  display: flex;
  justify-content: center;
  color: var(--google-red);
}

.btn-danger {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 24px;
  border-radius: 24px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  letter-spacing: 0.25px;
  background-color: var(--google-red);
  color: white;
}

.btn-danger:hover {
  background-color: #d93025;
  box-shadow: 0 1px 2px 0 rgba(234, 67, 53, 0.3);
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  background-color: #323232;
  color: white;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: var(--shadow-3);
  animation: toastIn 0.3s ease;
  pointer-events: auto;
  max-width: 90vw;
}

.toast.toast-success {
  background-color: var(--google-green);
}

.toast.toast-error {
  background-color: var(--google-red);
}

.toast.toast-info {
  background-color: var(--google-blue);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

.toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}

/* ============================================
   Photo Item Selection Mode
   ============================================ */

.photo-item.selected::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  background-color: var(--google-blue);
  border-radius: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-item.selected::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 3px solid var(--google-blue);
  border-radius: 4px;
  z-index: 1;
  pointer-events: none;
}

/* ============================================
   Selection Toolbar
   ============================================ */

.selection-toolbar {
  position: fixed;
  top: var(--header-height);
  left: var(--sidebar-width);
  right: 0;
  height: 56px;
  background-color: #e8f0fe;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 95;
  transform: translateY(-100%);
  transition: transform var(--transition-medium);
}

.selection-toolbar.active {
  transform: translateY(0);
}

.selection-count {
  font-size: 14px;
  font-weight: 500;
  color: var(--google-blue);
}

.selection-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 960px) {
  .selection-toolbar {
    left: 0;
  }

  .modal-content {
    width: 95%;
    margin: 16px;
  }

  .modal-header,
  .modal-footer {
    padding: 16px;
  }

  .modal-body {
    padding: 16px;
  }
}

/* ============================================
   Security & TOTP Styles
   ============================================ */

.security-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

.security-loading {
  text-align: center;
  padding: 40px;
  color: #5f6368;
}

.security-error {
  text-align: center;
  padding: 40px;
  color: #d93025;
}

.security-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  margin-bottom: 16px;
}

.security-card-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8f0fe;
  border-radius: 50%;
  color: #1a73e8;
}

.security-card-info {
  flex: 1;
}

.security-card-info h3 {
  font-size: 16px;
  font-weight: 500;
  color: #202124;
  margin-bottom: 4px;
}

.security-card-info p {
  font-size: 14px;
  color: #5f6368;
}

.security-card-action {
  flex-shrink: 0;
}

.security-hint {
  padding: 24px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
}

.security-hint h4 {
  font-size: 14px;
  font-weight: 500;
  color: #202124;
  margin-bottom: 8px;
}

.security-hint p {
  font-size: 13px;
  color: #5f6368;
  line-height: 1.6;
}

.totp-setup {
  padding: 8px;
}

.totp-step {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.totp-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a73e8;
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
}

.totp-step p {
  font-size: 14px;
  color: #202124;
}

.totp-qr-container {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  margin-bottom: 16px;
}

.totp-qr-container img {
  border-radius: 8px;
}

.totp-manual {
  text-align: center;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 8px;
}

.totp-manual p {
  font-size: 12px;
  color: #5f6368;
  margin-bottom: 8px;
}

.totp-secret {
  display: block;
  font-family: 'Roboto Mono', monospace;
  font-size: 16px;
  font-weight: 600;
  color: #202124;
  letter-spacing: 2px;
  margin-bottom: 8px;
  word-break: break-all;
}

.btn-text {
  background: none;
  border: none;
  color: #1a73e8;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}

.btn-text:hover {
  text-decoration: underline;
}

.totp-setup-error {
  text-align: center;
  padding: 40px;
  color: #d93025;
}

@media (max-width: 600px) {
  .security-card {
    flex-direction: column;
    text-align: center;
  }

  .security-card-action {
    width: 100%;
  }

  .security-card-action button {
    width: 100%;
  }
}

/* ============================================
   Login Overlay
   ============================================ */

.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f8f9fa 0%, #e8f0fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.login-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.1), 0 4px 12px 4px rgba(60, 64, 67, 0.12);
  padding: 48px 40px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.login-title {
  font-size: 24px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 24px;
}

/* Step indicator */
.step-indicator {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  transition: background var(--transition-fast);
}

.step-dot.active {
  background: var(--google-blue);
}

/* Step labels */
.step-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Login form */
.login-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
  margin-bottom: 16px;
}

.login-input:focus {
  border-color: var(--google-blue);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.login-btn {
  width: 100%;
  padding: 12px 16px;
  background: var(--google-blue);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.login-btn:hover:not(:disabled) {
  background: var(--google-blue-dark);
  box-shadow: var(--shadow-1);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.turnstile-wrapper {
  display: flex;
  justify-content: center;
  margin: 12px 0;
  min-height: 65px;
}

.turnstile-wrapper:empty {
  display: none;
}

.login-error {
  color: var(--google-red);
  font-size: 14px;
  margin-top: 12px;
  min-height: 20px;
}

.login-hint {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 16px;
}

/* TOTP Step - hidden by default, shown when .show class is added */
.totp-field {
  display: none;
}

.totp-field.show {
  display: block;
}

/* TOTP input */
.totp-input-wrapper {
  position: relative;
  margin-bottom: 16px;
}

.totp-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
}

.totp-code-input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 8px;
  text-align: center;
  font-family: 'Roboto', monospace;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
}

.totp-code-input:focus {
  border-color: var(--google-blue);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

/* Back link */
.back-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--google-blue);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: text-decoration var(--transition-fast);
}

.back-link:hover {
  text-decoration: underline;
}

/* ============================================
   Empty State & Picker UI
   ============================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  width: 100%;
}

.empty-state-icon {
  margin-bottom: 16px;
  opacity: 0.8;
}

.empty-state-title {
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.empty-state-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 400px;
  margin: 0 0 24px 0;
}

.btn-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  background: var(--google-blue);
  color: white;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-1);
}

.btn-picker:hover:not(:disabled) {
  background: var(--google-blue-dark);
  box-shadow: var(--shadow-2);
}

.btn-picker:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.picker-polling-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

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

/* Picker button in header */
.header-pick-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--google-blue);
  background: transparent;
  border: 1px solid var(--google-blue);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.header-pick-btn:hover {
  background: rgba(26, 115, 232, 0.08);
}

/* Responsive */
@media (max-width: 480px) {
  .login-card {
    padding: 32px 24px;
  }

  .login-title {
    font-size: 20px;
  }

  .empty-state {
    padding: 48px 16px;
  }

  .empty-state-title {
    font-size: 18px;
  }
}
