/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --background: #0a0a0a;
  --foreground: #fafafa;
  --card: #111111;
  --card-foreground: #fafafa;
  --primary: #3b82f6;
  --primary-foreground: #f8fafc;
  --accent: #06b6d4;
  --accent-foreground: #0f172a;
  --muted: #262626;
  --muted-foreground: #a3a3a3;
  --border: #262626;
  --destructive: #ef4444;
  --destructive-foreground: #fef2f2;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header Styles */
.header {
  border-bottom: 1px solid var(--border);
  background-color: rgba(17, 17, 17, 0.5);
  backdrop-filter: blur(8px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-container {
  position: relative;
}

.logo-icon {
  width: 2rem;
  height: 2rem;
  color: var(--primary);
}

.status-dot {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  width: 0.75rem;
  height: 0.75rem;
  background-color: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--foreground);
}

.logo-text p {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.system-status {
  display: none;
}

@media (min-width: 768px) {
  .system-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
  }
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.status-dot-small {
  width: 0.5rem;
  height: 0.5rem;
  background-color: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* Main Content */
.main-content {
  padding: 2rem 0;
}

.content-wrapper {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Card Styles */
.card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
}

.card-content {
  padding: 1.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.section-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--primary);
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.section-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}

.input-field {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background-color: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
}

.input-field.error {
  border-color: var(--destructive);
}

.error-message {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--destructive);
  font-size: 0.875rem;
}

.error-icon {
  width: 1rem;
  height: 1rem;
}

.help-text {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Upload Area */
.upload-card {
  position: relative;
}

.binary-background {
  position: absolute;
  inset: 0;
  opacity: 0.05;
}

.gradient-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(6, 182, 212, 0.2));
}

.binary-text {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-size: 0.75rem;
  font-family: "Courier New", monospace;
  color: rgba(59, 130, 246, 0.3);
  line-height: 1.2;
}

.upload-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 0.5rem;
  padding: 3rem;
  text-align: center;
  transition: all 0.2s;
  cursor: not-allowed;
}

.upload-area.enabled {
  cursor: pointer;
}

.upload-area.enabled:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background-color: rgba(59, 130, 246, 0.05);
}

.upload-area.drag-over {
  border-color: var(--accent);
  background-color: rgba(6, 182, 212, 0.05);
  transform: scale(1.02);
}

.upload-area.disabled {
  border-color: var(--muted);
  background-color: rgba(38, 38, 38, 0.2);
}

.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: inherit;
}

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

.upload-icon-container {
  width: 4rem;
  height: 4rem;
  margin: 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(59, 130, 246, 0.1);
}

.upload-icon-container.disabled {
  background-color: var(--muted);
}

.upload-icon {
  width: 2rem;
  height: 2rem;
  color: var(--primary);
}

.upload-icon.disabled {
  color: var(--muted-foreground);
}

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

#upload-title {
  font-size: 1.125rem;
  font-weight: 600;
}

#upload-description {
  color: var(--muted-foreground);
}

.bucket-info {
  color: var(--accent);
  font-size: 0.875rem;
}

.bucket-name {
  font-family: "Courier New", monospace;
  font-weight: 500;
}

.file-types {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* File Preview */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.file-item {
  position: relative;
  group: hover;
}

.file-preview {
  aspect-ratio: 1;
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: var(--muted);
}

.file-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.file-item:hover .file-overlay {
  opacity: 1;
}

.file-status {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-status.uploading {
  background-color: rgba(59, 130, 246, 0.9);
}

.file-status.success {
  background-color: var(--accent);
}

.file-status.error {
  background-color: var(--destructive);
}

.file-info {
  margin-top: 0.5rem;
}

.file-name {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
  justify-content: center;
}

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

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover:not(:disabled) {
  background-color: rgba(59, 130, 246, 0.9);
}

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

.btn-outline:hover:not(:disabled) {
  background-color: var(--muted);
}

.btn-destructive {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
}

.action-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* Spinner */
.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Bucket Access */
.bucket-item {
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.bucket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.bucket-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bucket-title h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.bucket-title .bucket-name {
  font-family: "Courier New", monospace;
  color: var(--accent);
}

.bucket-date {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.bucket-files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.bucket-file {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
}

.file-header {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.file-thumbnail {
  width: 4rem;
  height: 4rem;
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: var(--muted);
  flex-shrink: 0;
}

.file-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-details {
  flex: 1;
  min-width: 0;
}

.file-details .file-name {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.file-details .file-size {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
}

.upload-status {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--accent);
}

.url-controls {
  display: flex;
  gap: 0.5rem;
}

.url-input {
  flex: 1;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background-color: var(--background);
  color: var(--foreground);
  font-size: 0.75rem;
  font-family: "Courier New", monospace;
}

.btn-sm {
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  min-width: auto;
}

/* Animations */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

/* Responsive */
@media (max-width: 768px) {
  .content-wrapper {
    padding: 0 0.5rem;
  }

  .card-content {
    padding: 1rem;
  }

  .upload-area {
    padding: 2rem 1rem;
  }

  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .bucket-files {
    grid-template-columns: 1fr;
  }
}
