/* Library View Styles */

#library-view {
  display: none;
  flex-direction: column;
  height: 100vh;
  background: #1a1a1a;
  overflow: hidden;
}

.library-header {
  padding: 2rem;
  background: #2d2d2d;
  border-bottom: 2px solid #404040;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.library-title {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.library-header h2 {
  color: #00d4ff;
  font-size: 2rem;
  margin: 0;
}

.library-stats {
  color: #aaa;
  font-size: 1.1rem;
}

.library-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.library-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #d0d0d0;
  font-size: 0.9rem;
}

.library-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #444;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  overflow: hidden;
}

.library-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.library-logout {
  background: transparent;
  border: 1px solid #555;
  color: #d0d0d0;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.library-logout:hover {
  background: #3a3a3a;
}

.upload-btn {
  background: #00d4ff;
  color: #000;
  border: none;
  padding: 0.65rem 1.5rem;
  font-size: 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s ease, background 0.2s ease;
}

.upload-btn:hover {
  background: #00a8cc;
  transform: translateY(-1px);
}

.upload-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.upload-input {
  display: none;
}

.upload-status {
  min-height: 2.5rem;
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  background: #1f1f1f;
  border-bottom: 2px solid #2b2b2b;
  color: #ccc;
  font-size: 0.95rem;
}

.upload-status:empty {
  display: none;
}

.upload-status--success {
  color: #00ff88;
}

.upload-status--error {
  color: #ff6b6b;
}

.upload-progress {
  height: 6px;
  background: #3a3a3a;
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #00d4ff, #00ff88);
  transition: width 0.2s ease;
}

.library-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 2rem;
  padding: 2rem;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* Comic Card */
.comic-card {
  background: #2d2d2d;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 3px solid transparent;
}

.comic-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.comic-card.selected {
  border-color: #00d4ff;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
  transform: scale(1.05);
}

.comic-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #1a1a1a;
}

.comic-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.comic-card:hover .comic-cover img {
  transform: scale(1.1);
}

.comic-format-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 212, 255, 0.9);
  color: #000;
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  font-weight: bold;
  font-size: 0.8rem;
}

.comic-info {
  padding: 1rem;
}

.comic-title {
  color: #fff;
  font-size: 1.1rem;
  margin: 0 0 0.5rem 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.comic-meta {
  display: flex;
  gap: 1rem;
  color: #aaa;
  font-size: 0.9rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Library Footer */
.library-footer {
  padding: 1rem 2rem;
  background: #2d2d2d;
  border-top: 2px solid #404040;
  text-align: center;
}

.controls-hint {
  color: #aaa;
  margin: 0;
  font-size: 0.9rem;
}

.controls-hint strong {
  color: #00d4ff;
}

/* Loading State */
.library-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #aaa;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #404040;
  border-top-color: #00d4ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

/* Error State */
.library-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 2rem;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.library-error h2 {
  color: #ff6b6b;
  margin-bottom: 1rem;
}

.library-error p {
  color: #aaa;
  margin-bottom: 2rem;
  max-width: 500px;
}

.retry-btn {
  background: #00d4ff;
  color: #000;
  border: none;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s;
  font-weight: bold;
}

.retry-btn:hover {
  background: #00a8cc;
}

.empty-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Empty State */
.library-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 2rem;
}

.empty-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
}

.library-empty h2 {
  color: #00d4ff;
  margin-bottom: 1rem;
}

.library-empty p {
  color: #aaa;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.library-empty code {
  background: #2d2d2d;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  color: #00d4ff;
  font-family: 'Courier New', monospace;
}

.supported-formats {
  background: #2d2d2d;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  max-width: 400px;
}

.supported-formats h3 {
  color: #00d4ff;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.supported-formats ul {
  list-style: none;
  padding: 0;
  text-align: left;
}

.supported-formats li {
  color: #aaa;
  margin-bottom: 0.5rem;
  padding-left: 1.5rem;
  position: relative;
}

.supported-formats li::before {
  content: '•';
  color: #00d4ff;
  position: absolute;
  left: 0;
  font-size: 1.5rem;
  line-height: 1;
}

.supported-formats strong {
  color: #fff;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

@media (max-width: 900px) {
  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
  }

  .library-header {
    padding: 1.5rem;
  }

  .library-header h2 {
    font-size: 1.5rem;
  }
}

@media (max-width: 600px) {
  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    padding: 1rem;
  }

  .library-header {
    padding: 1rem;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .library-actions {
    width: 100%;
    justify-content: center;
  }

  .comic-title {
    font-size: 1rem;
  }

  .comic-meta {
    font-size: 0.8rem;
  }
}

/* Reading Progress Indicators */
.progress-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #00d4ff 0%, #0099cc 100%);
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.progress-indicator.complete .progress-bar {
  background: linear-gradient(90deg, #00ff88 0%, #00cc66 100%);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.completion-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  background: rgba(0, 255, 136, 0.95);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0, 255, 136, 0.6);
  animation: completion-pop 0.4s ease;
}

@keyframes completion-pop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.progress-text {
  color: #00d4ff !important;
  font-weight: bold;
}

/* Scrollbar Styling */
.library-grid::-webkit-scrollbar {
  width: 12px;
}

.library-grid::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.library-grid::-webkit-scrollbar-thumb {
  background: #404040;
  border-radius: 6px;
}

.library-grid::-webkit-scrollbar-thumb:hover {
  background: #00d4ff;
}
