/* ============================================================
   PICHOST — Main Stylesheet
   ============================================================ */

:root {
  --bg-base:     #0f0f13;
  --bg-card:     #1a1a24;
  --bg-card-alt: #1f1f2e;
  --border-color:#2a2a40;
  --primary:     #6c63ff;
  --primary-dark:#5b52e0;
  --text-main:   #e8e8f0;
  --text-muted:  #8080a0;
  --success:     #22c55e;
  --danger:      #ef4444;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }

body {
  background: var(--bg-base);
  color: var(--text-main);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ============================================================
   BOOTSTRAP OVERRIDES
   ============================================================ */
.bg-dark-card { background: var(--bg-card) !important; }

.card {
  background: var(--bg-card);
  border-color: var(--border-color);
  border-radius: 12px;
}

.form-control, .form-select {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-main) !important;
  border-radius: 8px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(108, 99, 255, .2) !important;
  outline: none;
}
.form-control::placeholder { color: var(--text-muted); }

.form-label { color: var(--text-main); }
.form-text  { color: var(--text-muted); font-size: .8rem; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  border-radius: 8px;
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-outline-secondary {
  border-color: var(--border-color);
  color: var(--text-muted);
  border-radius: 8px;
}
.btn-outline-secondary:hover {
  background: var(--bg-card-alt);
  color: var(--text-main);
  border-color: var(--primary);
}

.input-group-text {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-muted) !important;
}

.alert {
  border-radius: 10px;
  border: 1px solid;
}
.alert-success { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.3); color: #86efac; }
.alert-danger  { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3);  color: #fca5a5; }
.alert-info    { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.3); color: #93c5fd; }

.badge { border-radius: 6px; }
.badge.bg-secondary { background: var(--bg-card-alt) !important; color: var(--text-muted); }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  background: rgba(10, 10, 18, .95) !important;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: .75rem 0;
  z-index: 1030;
}

.navbar .dropdown-menu {
  z-index: 1031;
}

.navbar-brand {
  font-size: 1.25rem;
  letter-spacing: -.5px;
}

.nav-link {
  color: var(--text-muted) !important;
  border-radius: 8px;
  padding: .4rem .8rem !important;
  transition: color .15s, background .15s;
}
.nav-link:hover, .nav-link.active {
  color: var(--text-main) !important;
  background: rgba(108, 99, 255, .12);
}

/* ============================================================
   AVATAR
   ============================================================ */
.avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-lg {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   GALLERY HERO
   ============================================================ */
.gallery-hero {
  background: linear-gradient(135deg, rgba(108,99,255,.12) 0%, rgba(91,82,224,.05) 100%);
  border: 1px solid rgba(108, 99, 255, .2);
}

/* ============================================================
   GALLERY GRID
   ============================================================ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.gallery-item {
  display: block;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-card);
  aspect-ratio: 1;
  border: 1px solid var(--border-color);
  transition: transform .2s, border-color .2s;
}
.gallery-item:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}
.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity .2s;
}
.gallery-item:hover img { opacity: .85; }

.gallery-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.8) 0%, transparent 50%);
  opacity: 0;
  transition: opacity .2s;
  display: flex;
  align-items: flex-end;
  padding: 10px;
}
.gallery-item:hover .gallery-overlay { opacity: 1; }

.gallery-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gallery-title {
  font-size: .8rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.gallery-meta {
  font-size: .7rem;
  color: rgba(255,255,255,.7);
}

/* ============================================================
   DROP ZONE
   ============================================================ */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: 16px;
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.drop-zone.drag-over,
.drop-zone:hover {
  border-color: var(--primary);
  background: rgba(108, 99, 255, .05);
}

.drop-zone-small {
  border: 2px dashed var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .2s;
}
.drop-zone-small:hover,
.drop-zone-small.drag-over {
  border-color: var(--primary);
  background: rgba(108, 99, 255, .05);
}

.cursor-pointer { cursor: pointer; }

/* ============================================================
   UPLOAD QUEUE
   ============================================================ */
.file-queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 8px;
  transition: border-color .2s;
}

.file-thumb {
  width: 56px; height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--bg-card-alt);
}

.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: .78rem; color: var(--text-muted); }

.file-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Progress bar inside queue items */
.upload-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--border-color);
  margin-top: 6px;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width .3s;
}

/* ============================================================
   RESULT CARDS
   ============================================================ */
.result-card {
  background: var(--bg-card);
  border: 1px solid rgba(34, 197, 94, .3);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 8px;
}
.result-card .result-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.result-link-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-link-item input {
  font-size: .75rem;
  background: var(--bg-card-alt) !important;
}

/* ============================================================
   IMAGE VIEWER
   ============================================================ */
.image-viewer-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0f;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination .page-link {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-muted);
  border-radius: 8px !important;
  margin: 0 2px;
}
.pagination .page-link:hover {
  background: var(--bg-card-alt);
  color: var(--text-main);
}
.pagination .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.pagination .page-item.disabled .page-link { opacity: .4; }

/* ============================================================
   DROPDOWN
   ============================================================ */
.dropdown-menu-dark {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 10px;
  padding: .5rem;
}
.dropdown-menu-dark .dropdown-item {
  color: var(--text-main);
  border-radius: 6px;
  padding: .5rem .75rem;
  font-size: .9rem;
}
.dropdown-menu-dark .dropdown-item:hover { background: var(--bg-card-alt); }
.dropdown-menu-dark .dropdown-item.text-danger:hover { background: rgba(239,68,68,.1); }
.dropdown-divider { border-color: var(--border-color); }

/* ============================================================
   LIST GROUP
   ============================================================ */
.list-group-item {
  border-color: var(--border-color) !important;
  transition: background .15s, color .15s;
}
.list-group-item.active, .list-group-item.active-link.active {
  background: rgba(108,99,255,.15) !important;
  color: var(--primary) !important;
  border-color: rgba(108,99,255,.3) !important;
}
.list-group-item-action:hover {
  background: var(--bg-card-alt) !important;
  color: var(--text-main) !important;
}

/* ============================================================
   IMAGE CARD (DASHBOARD)
   ============================================================ */
.image-card {
  border-radius: 12px;
  overflow: hidden;
  transition: transform .2s, border-color .2s;
}
.image-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary) !important;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: rgba(0,0,0,.4) !important;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }
  .gallery-overlay { opacity: 1; }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
