/* Core Theme Variables */
:root {
  --bg-color: #0b0d13;
  --panel-bg: rgba(20, 24, 38, 0.6);
  --border-color: rgba(255, 255, 255, 0.06);
  
  --primary-glow: rgba(138, 43, 226, 0.4);
  --accent-glow: rgba(0, 255, 255, 0.25);
  
  --color-primary: #a855f7;
  --color-accent: #00ffff;
  --color-text: #f3f4f6;
  --color-text-muted: #9ca3af;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  
  --transition-speed: 0.3s;
  
  /* Wood Frame Colors */
  --wood-light: #8B5A2B;
  --wood-medium: #5C4033;
  --wood-dark: #3D2314;
  --wood-matte: #e8dcc4;
}

/* Base Setup */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-color);
  color: var(--color-text);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* Background Glow Effects */
.glow-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: 
    radial-gradient(circle at 10% 20%, var(--primary-glow) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, var(--accent-glow) 0%, transparent 35%);
  filter: blur(80px);
  pointer-events: none;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Glassmorphic Card base style */
.card {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  padding: 2rem;
  transition: transform var(--transition-speed), box-shadow var(--transition-speed), border-color var(--transition-speed);
}

.card:hover {
  border-color: rgba(168, 85, 247, 0.25);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5), 0 0 15px rgba(168, 85, 247, 0.05);
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.4));
}

.header h1 {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.8rem;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #e2e8f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-top: 0.1rem;
}

.status-container {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.status-dot.green {
  background-color: var(--color-success);
  box-shadow: 0 0 10px var(--color-success);
  animation: pulse-green 2s infinite;
}

.status-dot.red {
  background-color: var(--color-danger);
  box-shadow: 0 0 10px var(--color-danger);
}

.hash-container {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  height: 38px;
}

.hash-label {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0 0.8rem;
  color: var(--color-accent);
  letter-spacing: 0.05em;
}

.hash-code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #fff;
  padding: 0 0.8rem;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.01);
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0 0.8rem;
  height: 100%;
  display: flex;
  align-items: center;
  transition: color var(--transition-speed), background-color var(--transition-speed);
}

.copy-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

/* Grid Layout */
.main-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
}

@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

/* Headings & Descriptions */
h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.5rem;
}

h2 i {
  color: var(--color-primary);
}

.section-desc {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* Upload Drop Zone */
.drop-zone {
  border: 2px dashed rgba(168, 85, 247, 0.3);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.15);
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  cursor: pointer;
  transition: border-color var(--transition-speed), background-color var(--transition-speed);
  position: relative;
  overflow: hidden;
}

.drop-zone.dragover {
  border-color: var(--color-accent);
  background: rgba(168, 85, 247, 0.08);
}

.drop-zone-content {
  text-align: center;
  transition: opacity var(--transition-speed);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.drop-icon {
  font-size: 3rem;
  color: var(--color-text-muted);
  transition: transform var(--transition-speed), color var(--transition-speed);
}

.drop-zone:hover .drop-icon {
  transform: translateY(-5px);
  color: var(--color-primary);
}

.drop-text-main {
  font-weight: 600;
  font-size: 1.1rem;
}

.drop-text-sub {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* Wooden Frame Preview */
.preview-frame-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  width: 100%;
}

.painting-frame {
  border: 14px solid var(--wood-medium);
  /* Generate wood texture lighting */
  border-image: linear-gradient(135deg, var(--wood-light) 0%, var(--wood-medium) 40%, var(--wood-dark) 100%) 14;
  outline: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: 
    inset 0 0 10px rgba(0, 0, 0, 0.8),
    0 10px 25px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  background-color: var(--wood-matte);
  padding: 6px;
  display: inline-block;
  max-width: 100%;
  transition: transform 0.5s ease-out;
}

.painting-frame:hover {
  transform: perspective(800px) rotateX(4deg) rotateY(-4deg) translateY(-2px);
}

.canvas-matte {
  background-color: #f7f4eb;
  /* Fabric matte look */
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(0, 0, 0, 0.15);
  padding: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.canvas-matte img {
  max-width: 260px;
  max-height: 200px;
  object-fit: contain;
  display: block;
  image-rendering: pixelated; /* Minecraft styling */
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2);
}

.file-details {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
}

.file-name {
  font-weight: 600;
  color: var(--color-text);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--color-text-muted);
}

/* Upload Button */
.submit-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--color-primary), #7c3aed);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  padding: 1rem;
  margin-top: 1.5rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.25);
  transition: background-color var(--transition-speed), transform 0.1s active, box-shadow var(--transition-speed);
}

.submit-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #b55fe6, #8b5cf6);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
}

.submit-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.submit-btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

/* Progress indicator */
.progress-container {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(to right, var(--color-primary), var(--color-accent));
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.progress-status {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* Log output */
.log-output {
  margin-top: 1.5rem;
  padding: 1.2rem;
  background: rgba(0, 0, 0, 0.3);
}

.log-output h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.log-lines {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  max-height: 150px;
  overflow-y: auto;
  color: #a7f3d0; /* Green terminal text */
}

.log-line {
  margin-bottom: 0.2rem;
  white-space: pre-wrap;
}

.log-line.warn {
  color: var(--color-warning);
}

.log-line.err {
  color: var(--color-danger);
}

/* Guide Panel */
.guide-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

/* Warning Notice Box */
.warning-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-top: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.warning-box i {
  color: var(--color-warning);
  font-size: 1.3rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.warning-box-content h4 {
  color: #fbbf24;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.warning-box-content p {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.step-card {
  display: flex;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 1rem;
  align-items: flex-start;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.step-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.step-info p {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.downloads-section {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.downloads-section h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.downloads-section p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin-bottom: 1rem;
}

.download-actions {
  display: flex;
  gap: 1rem;
}

.action-btn {
  flex: 1;
  padding: 0.8rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: background-color var(--transition-speed), border-color var(--transition-speed), transform 0.1s active;
}

.download-btn {
  background: var(--color-accent);
  color: #0b0d13;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 255, 255, 0.15);
}

.download-btn:hover {
  background: #33ffff;
  box-shadow: 0 6px 16px rgba(0, 255, 255, 0.3);
}

.secondary-btn {
  background: transparent;
  color: #fff;
  border: 1px solid var(--border-color);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--color-text-muted);
}

.fix-btn {
  background: transparent;
  color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.fix-btn:hover {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--color-warning);
}

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

.download-actions {
  flex-wrap: wrap;
}

.action-btn:active {
  transform: scale(0.97);
}

/* Gallery Section */
.gallery-section {
  margin-top: 1rem;
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.gallery-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-accent);
  background: rgba(0, 255, 255, 0.08);
  padding: 0.3rem 0.8rem;
  border-radius: 9999px;
  border: 1px solid rgba(0, 255, 255, 0.15);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
  min-height: 150px;
}

.gallery-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--color-text-muted);
  text-align: center;
  gap: 1rem;
}

.empty-icon {
  font-size: 2.5rem;
}

/* Gallery Cards (Framed Paintings) */
.gallery-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
  padding: 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid transparent;
  transition: background-color var(--transition-speed), border-color var(--transition-speed), transform var(--transition-speed);
}

.gallery-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-color);
  transform: translateY(-4px);
}

.gallery-item .painting-frame {
  border-width: 10px;
  padding: 3px;
}

.gallery-item .canvas-matte img {
  max-width: 120px;
  max-height: 90px;
}

.gallery-item-name {
  font-size: 0.8rem;
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-muted);
  text-align: center;
}

.gallery-item:hover .gallery-item-name {
  color: var(--color-text);
}

/* Lightbox Modal */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 5, 8, 0.9);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(10px);
}

.lightbox.active {
  opacity: 1;
  pointer-events: all;
}

.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  max-width: 90%;
  max-height: 90%;
}

.close-lightbox {
  position: absolute;
  top: 2rem;
  right: 2.5rem;
  font-size: 2.5rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition-speed);
}

.close-lightbox:hover {
  color: #fff;
}

.large-frame {
  border-width: 24px;
  padding: 10px;
}

.large-frame .canvas-matte img {
  max-width: 600px;
  max-height: 450px;
}

@media (max-width: 650px) {
  .large-frame {
    border-width: 16px;
  }
  .large-frame .canvas-matte img {
    max-width: 320px;
    max-height: 240px;
  }
}

#lightboxTitle {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
}

#lightboxMeta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* Keyframe Animations */
@keyframes pulse-green {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}
