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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0a;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Logo image */
.logo {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 2rem;
  border-radius: 8px;
}

/* Upload container */
.upload-container {
  background: #1a1a1a;
  border-radius: 8px;
  padding: 2rem;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Drop zone */
.drop-zone {
  border: 2px dashed #3a3a3a;
  border-radius: 8px;
  padding: 3rem;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
  background: #2a2a2a;
  border-color: #00d4ff;
}

/* Upload icon */
.upload-icon {
  width: 48px;
  height: 48px;
  color: #6a6a6a;
  margin-bottom: 1rem;
  transition: color 0.2s ease;
}

.drop-zone:hover .upload-icon,
.drop-zone.drag-over .upload-icon {
  color: #00d4ff;
}

/* Drop zone text */
.drop-text {
  font-size: 1.125rem;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.drop-hint {
  font-size: 0.875rem;
  color: #6a6a6a;
}

/* Error message */
.error-message {
  display: none;
  color: #ff6b6b;
  font-size: 0.875rem;
  text-align: center;
  padding: 0.5rem;
  background: rgba(255, 107, 107, 0.1);
  border-radius: 4px;
  margin-top: 1rem;
}

.error-message.visible {
  display: block;
}

/* Results list */
.results-list {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Upload item (placeholder styles for Plan 03) */
.upload-item {
  background: #2a2a2a;
  border-radius: 6px;
  padding: 1rem;
  display: flex;
  gap: 1rem;
}

.upload-thumbnail {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 4px;
}

.upload-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Progress bar */
.progress-bar {
  height: 6px;
  background: #3a3a3a;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #00d4ff 0%, #9d4edd 100%);
  transition: width 0.3s ease;
}

/* Logout link */
.logout-link {
  display: block;
  margin-top: 1.5rem;
  text-align: center;
  color: #6a6a6a;
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.logout-link:hover {
  color: #00d4ff;
}

/* Spinner animation */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #3a3a3a;
  border-top-color: #00d4ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Upload preview placeholder (during upload) */
.upload-preview-placeholder {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
  border-radius: 4px;
}

/* Upload item states */
.upload-item.uploading {
  opacity: 0.9;
}

.upload-item.error {
  border-left: 3px solid #ff6b6b;
}

/* Error icon */
.upload-error-icon {
  width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Error text */
.upload-error-text {
  color: #ff6b6b;
  font-size: 0.875rem;
}

/* Filename */
.upload-filename {
  color: #ffffff;
  font-size: 0.875rem;
  word-break: break-all;
}

/* Progress text */
.progress-text {
  color: #6a6a6a;
  font-size: 0.75rem;
}

/* URL input */
.upload-url {
  width: 100%;
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  color: #ffffff;
  font-size: 0.75rem;
  padding: 0.5rem;
  font-family: monospace;
}

.upload-url:focus {
  outline: none;
  border-color: #00d4ff;
}

/* Upload actions */
.upload-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Format select */
.format-select {
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  color: #ffffff;
  font-size: 0.75rem;
  padding: 0.375rem 0.5rem;
  cursor: pointer;
}

.format-select:focus {
  outline: none;
  border-color: #00d4ff;
}

/* Copy button */
.copy-btn {
  background: linear-gradient(135deg, #00d4ff 0%, #9d4edd 100%);
  border: none;
  border-radius: 4px;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.copy-btn:hover {
  opacity: 0.9;
}

.copy-btn.copied {
  background: #22c55e;
}

/* Success state */
.upload-item.success {
  align-items: flex-start;
}

/* Open button */
.open-btn {
  color: #6a6a6a;
  font-size: 0.75rem;
  text-decoration: none;
  padding: 0.375rem 0.5rem;
  transition: color 0.2s ease;
}

.open-btn:hover {
  color: #00d4ff;
}

/* Tab navigation */
.tab-bar {
  margin-bottom: 1.5rem;
}

.tab-bar [role="tablist"] {
  display: flex;
  gap: 0.25rem;
  background: #0a0a0a;
  padding: 0.25rem;
  border-radius: 6px;
}

.tab-bar [role="tab"] {
  flex: 1;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #6a6a6a;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.tab-bar [role="tab"]:hover {
  color: #ffffff;
}

.tab-bar [role="tab"][aria-selected="true"] {
  background: #2a2a2a;
  color: #ffffff;
}

/* History toolbar */
.history-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.view-toggle {
  display: flex;
  gap: 0.25rem;
  background: #0a0a0a;
  padding: 0.25rem;
  border-radius: 4px;
}

.view-btn {
  padding: 0.5rem;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #6a6a6a;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.view-btn:hover {
  color: #ffffff;
}

.view-btn.active {
  background: #2a2a2a;
  color: #00d4ff;
}

.bulk-delete-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  color: #6a6a6a;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bulk-delete-btn:hover:not(:disabled) {
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.bulk-delete-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* History grid view */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.history-grid[hidden],
.history-list[hidden] {
  display: none;
}

.history-grid-item {
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  background: #2a2a2a;
}

.history-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.history-grid-item:hover img {
  transform: scale(1.05);
}

.history-grid-item .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.history-grid-item:hover .overlay,
.history-grid-item:focus-within .overlay {
  opacity: 1;
}

.history-grid-item .item-info {
  font-size: 0.75rem;
  color: #ffffff;
}

.history-grid-item .item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.history-grid-item .item-meta {
  color: #6a6a6a;
}

.history-grid-item .item-actions {
  display: flex;
  gap: 0.5rem;
}

.history-grid-item .item-checkbox {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 18px;
  height: 18px;
  accent-color: #00d4ff;
}

/* History list view */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-list-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: #2a2a2a;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.history-list-item:hover {
  background: #333333;
}

.history-list-item .item-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #00d4ff;
}

.history-list-item .item-thumb {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  object-fit: contain;
}

.history-list-item .item-details {
  flex: 1;
  min-width: 0;
}

.history-list-item .item-name {
  color: #ffffff;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-list-item .item-meta {
  color: #6a6a6a;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.history-list-item .item-actions {
  display: flex;
  gap: 0.5rem;
}

/* Item action buttons */
.item-btn {
  padding: 0.375rem 0.5rem;
  background: transparent;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  color: #6a6a6a;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.item-btn:hover {
  border-color: #00d4ff;
  color: #00d4ff;
}

.item-btn.delete:hover {
  border-color: #ff6b6b;
  color: #ff6b6b;
}

/* Empty state */
.history-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #6a6a6a;
}

/* Delete confirmation dialog */
#delete-dialog {
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 400px;
  color: #ffffff;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

#delete-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

#delete-dialog h2 {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
}

#delete-dialog p {
  margin: 0 0 1.5rem;
  color: #9a9a9a;
  font-size: 0.875rem;
}

.dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.dialog-btn {
  padding: 0.625rem 1rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dialog-btn.cancel {
  background: transparent;
  border: 1px solid #3a3a3a;
  color: #ffffff;
}

.dialog-btn.cancel:hover {
  border-color: #6a6a6a;
}

.dialog-btn.danger {
  background: #ff6b6b;
  border: none;
  color: #ffffff;
}

.dialog-btn.danger:hover {
  background: #ff5252;
}

/* Fade out animation for deleted items */
.history-grid-item,
.history-list-item {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.history-grid-item.fade-out,
.history-list-item.fade-out {
  opacity: 0;
  transform: scale(0.95);
}

/* Footer links */
.footer-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #2a2a2a;
}

.text-btn {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0;
  transition: color 0.2s ease;
}

.text-btn:hover {
  color: #00d4ff;
}

/* Password dialog */
#password-dialog {
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
  color: #ffffff;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

#password-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

#password-dialog h2 {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
}

#password-dialog .form-group {
  margin-bottom: 1rem;
}

#password-dialog label {
  display: block;
  font-size: 0.875rem;
  color: #aaa;
  margin-bottom: 0.375rem;
}

#password-dialog input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  background: #0a0a0a;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  color: #ffffff;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

#password-dialog input:focus {
  outline: none;
  border-color: #00d4ff;
}

#password-dialog .error-message {
  color: #ff6b6b;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: none;
}

#password-dialog .error-message.visible {
  display: block;
}

#password-dialog .dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.dialog-btn.primary {
  background: linear-gradient(135deg, #00d4ff 0%, #9d4edd 100%);
  border: none;
  color: #ffffff;
}

.dialog-btn.primary:hover {
  opacity: 0.9;
}
