/* assets/style.css */
/* Mobile-first, enterprise-style dark UI for HTML Library Manager */

/* ---------- Design tokens ---------- */
:root {
  --color-page-bg: #0b1120;
  --color-header-bg: rgba(15,23,42,0.96);
  --color-header-border: rgba(148,163,184,0.4);
  --color-surface: #0f172a;
  --color-surface-alt: #020617;

  --color-border-subtle: rgba(148,163,184,0.35);
  --color-border-strong: rgba(148,163,184,0.7);

  --color-primary: #2563eb;
  --color-primary-soft: rgba(37,99,235,0.12);

  --color-success: #22c55e;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;

  --color-text: #e5e7eb;
  --color-text-muted: #9ca3af;
  --color-text-soft: #6b7280;

  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,0.5);
  --shadow-md: 0 12px 40px rgba(15,23,42,0.65);
  --shadow-lg: 0 20px 60px rgba(15,23,42,0.85);

  --transition-fast: 150ms ease-out;
  --transition-med: 220ms ease-out;

  --font-base: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, sans-serif;
}

/* ---------- Reset / base ---------- */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: 14px;
  line-height: 1.5;
  background: radial-gradient(circle at top, #1e293b 0, #020617 55%, #020617 100%);
  color: var(--color-text);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* ---------- App shell ---------- */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  background: linear-gradient(90deg, rgba(15,23,42,0.96), rgba(15,23,42,0.98));
  border-bottom: 1px solid var(--color-header-border);
  box-shadow: var(--shadow-sm);
}

.app-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.6rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 0.65rem;
  background: radial-gradient(circle at 30% 20%, #60a5fa, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: #f9fafb;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--color-text-soft);
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.app-nav a,
.app-nav button {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  color: var(--color-text-muted);
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.app-nav a.is-active,
.app-nav button.is-active {
  background: rgba(15,23,42,0.9);
  border-color: rgba(148,163,184,0.6);
  color: #e5e7eb;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.75);
}

.app-nav a:hover,
.app-nav button:hover {
  background: rgba(15,23,42,0.85);
  border-color: rgba(148,163,184,0.4);
  text-decoration: none;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding: 0.35rem 0.65rem;
  background: rgba(15,23,42,0.5);
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border-subtle);
}

.app-main {
  flex: 1;
  padding: 1rem 1rem 1.6rem;
}

.app-main-inner {
  max-width: 1400px;
  margin: 0 auto;
}

/* ---------- Panels / layout ---------- */

.app-page-title {
  margin: 0 0 0.4rem;
  font-size: 1.4rem;
  letter-spacing: 0.01em;
}

.app-page-subtitle {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--color-text-soft);
}

.layout-two-column {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.panel {
  background: radial-gradient(circle at top left, rgba(37,99,235,0.14), transparent 55%),
              var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-md);
  padding: 0.85rem 1rem 1rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.panel-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.panel-subtitle {
  font-size: 0.75rem;
  color: var(--color-text-soft);
}

.panel-body {
  font-size: 0.85rem;
}

/* Desktop split */
@media (min-width: 960px) {
  .layout-two-column {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    align-items: flex-start;
    gap: 1rem;
  }
}

/* ---------- Form controls ---------- */

.field-group {
  margin-bottom: 0.85rem;
}

.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

input[type="text"],
input[type="search"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148,163,184,0.65);
  background: rgba(15,23,42,0.9);
  color: var(--color-text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              background var(--transition-fast),
              transform 100ms ease-out;
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-soft);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.3);
  background: #020617;
  transform: translateY(-0.5px);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #9ca3af 50%),
    linear-gradient(135deg, #9ca3af 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 48%,
    calc(100% - 9px) 48%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

textarea.small {
  min-height: 50px;
  max-height: 100px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: var(--color-text);
  text-decoration: none;
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              transform 100ms ease-out,
              box-shadow var(--transition-fast);
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: radial-gradient(circle at 30% 0, #60a5fa, #2563eb);
  border-color: rgba(37,99,235,0.9);
  color: #f9fafb;
  box-shadow: 0 10px 30px rgba(37,99,235,0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 40px rgba(37,99,235,0.5);
}

.btn-secondary {
  border-color: rgba(148,163,184,0.7);
  background: rgba(15,23,42,0.9);
  color: var(--color-text-muted);
}

.btn-secondary:hover {
  background: rgba(15,23,42,1);
  border-color: rgba(148,163,184,0.9);
}

.btn-ghost {
  border-color: transparent;
  color: var(--color-text-soft);
}

.btn-ghost:hover {
  border-color: rgba(148,163,184,0.5);
  background: rgba(15,23,42,0.85);
}

.btn-success {
  background: radial-gradient(circle at 30% 0, #4ade80, #22c55e);
  border-color: rgba(34,197,94,0.9);
  color: #f9fafb;
  box-shadow: 0 10px 30px rgba(34,197,94,0.35);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 40px rgba(34,197,94,0.5);
}

.btn-danger {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.5);
  color: #fca5a5;
}

.btn-danger:hover {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
}

.btn-small {
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
}

.btn-large {
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
}

.btn-block {
  width: 100%;
}

/* ---------- Chips / badges ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148,163,184,0.6);
  font-size: 0.72rem;
  color: var(--color-text-muted);
  background: rgba(15,23,42,0.9);
}

.chip-primary {
  border-color: rgba(37,99,235,0.5);
  color: #93c5fd;
  background: rgba(37,99,235,0.12);
}

.chip-success {
  border-color: rgba(34,197,94,0.5);
  color: #bbf7d0;
  background: rgba(34,197,94,0.12);
}

.chip-danger {
  border-color: rgba(248,113,113,0.6);
  color: #fecaca;
  background: rgba(248,113,113,0.12);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.06rem 0.35rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  color: var(--color-text-muted);
  background: rgba(15,23,42,0.9);
}

/* ---------- Library: filters ---------- */

.filters-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
}

.filters-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.filter-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  margin-top: 0.5rem;
}

.filter-row .field-group {
  flex: 1;
  margin-bottom: 0;
}

/* ---------- Library: stats ---------- */

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-soft);
  margin-bottom: 1rem;
}

.stats-row span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.stats-row strong {
  color: var(--color-primary);
  font-size: 1.1rem;
}

/* ---------- Controls bar ---------- */

.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.controls-left {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

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

.control-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.control-group label {
  font-size: 0.8rem;
  color: var(--color-text-soft);
  font-weight: 500;
}

.control-group select {
  width: auto;
  padding: 0.35rem 2rem 0.35rem 0.55rem;
}

/* ---------- View mode toggle ---------- */

.view-toggle {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148,163,184,0.6);
  background: rgba(15,23,42,0.9);
  padding: 0.12rem;
}

.view-toggle button {
  border: none;
  background: transparent;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  color: var(--color-text-soft);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.view-toggle button.active {
  background: rgba(37,99,235,0.2);
  color: var(--color-text);
}

.view-toggle button:hover:not(.active) {
  color: var(--color-text-muted);
}

/* ---------- Cards grid ---------- */

.cards-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .cards-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---------- Card ---------- */

.card {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background: radial-gradient(circle at top left, rgba(15,23,42,0.8), rgba(15,23,42,0.95));
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform var(--transition-med), box-shadow var(--transition-med);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(37,99,235,0.18), transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-med);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 50px rgba(15,23,42,0.9);
}

.card:hover::before {
  opacity: 1;
}

.card-screenshot {
  width: 100%;
  height: 180px;
  background: var(--color-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.card-screenshot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.card-screenshot img:hover {
  opacity: 0.85;
}

.card-screenshot-placeholder {
  color: var(--color-text-soft);
  font-size: 2.5rem;
}

.card-content {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.card-header {
  margin-bottom: 0.25rem;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  line-height: 1.3;
}

.card-title a {
  text-decoration: none;
  color: inherit;
}

.card-title a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.card-hierarchy {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  font-size: 0.72rem;
}

.hierarchy-item {
  background: rgba(37,99,235,0.15);
  color: var(--color-text-muted);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
}

.card-meta {
  font-size: 0.72rem;
  color: var(--color-text-soft);
  padding: 0.5rem;
  background: rgba(15,23,42,0.6);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.card-description {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border-subtle);
}

.card-actions .btn {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
}

/* ---------- List view ---------- */

.list-view {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.list-view .card {
  flex-direction: row;
  align-items: stretch;
}

.list-view .card-screenshot {
  width: 220px;
  height: 140px;
  flex-shrink: 0;
}

.list-view .card-content {
  flex: 1;
}

.list-view .card-actions {
  flex-wrap: wrap;
}

.list-view .card-actions .btn {
  flex: 0 1 auto;
}

@media (max-width: 768px) {
  .list-view .card {
    flex-direction: column;
  }

  .list-view .card-screenshot {
    width: 100%;
    height: 160px;
  }
}

/* ---------- Screenshot Modal ---------- */

.screenshot-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
}

.screenshot-modal.active {
  display: flex;
}

.screenshot-modal.zoomed {
  cursor: zoom-out;
  overflow: auto;
  align-items: flex-start;
  justify-content: center;
}

.screenshot-modal.zoomed.panning {
  cursor: grabbing;
}

.screenshot-modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  transition: transform var(--transition-med);
}

.screenshot-modal.zoomed .screenshot-modal-content {
  max-width: none;
  max-height: none;
  cursor: grab;
  margin: 0;
  padding: 0;
}

.screenshot-modal.zoomed.panning .screenshot-modal-content {
  cursor: grabbing;
}

.screenshot-modal img {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.screenshot-modal.zoomed img {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  border-radius: 0;
  box-shadow: none;
}

.screenshot-modal-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  z-index: 10001;
}

.screenshot-modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.screenshot-modal-hint {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15,23,42,0.95);
  color: var(--color-text);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  backdrop-filter: blur(20px);
  z-index: 10001;
  pointer-events: none;
  border: 1px solid var(--color-border-subtle);
}

/* ---------- Progress Modal ---------- */

.progress-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.progress-modal.active {
  display: flex;
}

.progress-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 450px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border-subtle);
}

.progress-card h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: var(--color-text);
}

.progress-bar-container {
  background: var(--color-surface-alt);
  height: 20px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar {
  background: radial-gradient(circle at 30% 0, #60a5fa, #2563eb);
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

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

/* ---------- Upload page ---------- */

.upload-layout {
  max-width: 800px;
  margin: 0 auto;
}

.dropzone {
  border-radius: var(--radius-lg);
  border: 2px dashed var(--color-border-strong);
  padding: 2rem 1.5rem;
  text-align: center;
  background: linear-gradient(145deg, rgba(15,23,42,1), rgba(15,23,42,0.96));
  cursor: pointer;
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              transform 100ms ease-out,
              box-shadow var(--transition-fast);
}

.dropzone-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--color-text-muted);
}

.dropzone-text {
  font-size: 0.9rem;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.dropzone small {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-soft);
}

.dropzone.dragover {
  border-color: var(--color-primary);
  background: linear-gradient(145deg, rgba(37,99,235,0.15), rgba(15,23,42,0.98));
  box-shadow: 0 16px 40px rgba(37,99,235,0.3);
  transform: translateY(-2px);
}

.file-list {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.file-list ul {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.file-list li:last-child {
  border-bottom: none;
}

.file-list li span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Editor layout ---------- */

.editor-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.editor-toolbar {
  background: linear-gradient(90deg, rgba(15,23,42,0.98), rgba(15,23,42,0.96));
  border-bottom: 1px solid var(--color-header-border);
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.editor-toolbar-title {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.editor-toolbar-actions {
  display: flex;
  gap: 0.5rem;
}

.editor-container {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  position: relative;
}

.editor-panel {
  width: 35%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  overflow: hidden;
}

.preview-panel {
  width: 65%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-surface-alt);
  overflow: hidden;
}

.resizer {
  width: 6px;
  background: var(--color-border-subtle);
  cursor: col-resize;
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.resizer:hover,
.resizer.dragging {
  background: var(--color-primary);
}

.metadata-section {
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border-subtle);
  flex-shrink: 0;
}

.metadata-header {
  padding: 0.5rem 0.85rem;
  background: rgba(15,23,42,0.8);
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  transition: background var(--transition-fast);
}

.metadata-header:hover {
  background: rgba(15,23,42,1);
}

.metadata-content {
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.metadata-content.expanded {
  max-height: 350px;
  padding: 0.75rem 0.85rem;
  overflow-y: auto;
}

.code-editor {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.code-header {
  padding: 0.5rem 0.85rem;
  background: #1a1a2e;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(148,163,184,0.2);
  flex-shrink: 0;
}

#htmlEditor {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  padding: 0.85rem;
  border: none;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  resize: none;
  background: #1a1a2e;
  color: #d4d4d4;
  tab-size: 2;
  overflow-y: auto;
}

#htmlEditor:focus {
  outline: none;
}

.preview-header {
  padding: 0.5rem 0.85rem;
  background: rgba(15,23,42,0.8);
  border-bottom: 1px solid var(--color-border-subtle);
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-frame {
  flex: 1;
  min-height: 0;
  border: none;
  background: white;
}

.preview-panel.mobile-view .preview-frame {
  width: 480px;
  max-width: 480px;
  min-width: 480px;
  margin: 0 auto;
  border-left: 1px solid var(--color-border-subtle);
  border-right: 1px solid var(--color-border-subtle);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.view-mode-toggle {
  display: flex;
  gap: 0.15rem;
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
  padding: 0.1rem;
  border: 1px solid var(--color-border-subtle);
}

.view-mode-btn {
  padding: 0.25rem 0.5rem;
  border: none;
  background: transparent;
  color: var(--color-text-soft);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.view-mode-btn:hover {
  color: var(--color-text-muted);
}

.view-mode-btn.active {
  background: var(--color-primary);
  color: white;
}

.status-bar {
  padding: 0.35rem 0.85rem;
  background: rgba(15,23,42,0.95);
  border-top: 1px solid var(--color-border-subtle);
  font-size: 0.7rem;
  color: var(--color-text-soft);
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
  line-height: 1.4;
}

@media (max-width: 1024px) {
  .editor-container {
    flex-direction: column;
  }

  .editor-panel,
  .preview-panel {
    width: 100% !important;
    height: 50%;
  }

  .resizer {
    width: 100%;
    height: 6px;
    cursor: row-resize;
  }
}

/* ---------- Login / centered card pages ---------- */

.centered-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  border: 1px solid var(--color-border-subtle);
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-logo h1 {
  font-size: 1.5rem;
  color: var(--color-text);
  margin: 0 0 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.auth-logo p {
  color: var(--color-text-soft);
  font-size: 0.85rem;
  margin: 0;
}

.auth-form .field-group {
  margin-bottom: 1rem;
}

.auth-info {
  margin-top: 1.25rem;
  padding: 0.85rem;
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--color-text-soft);
  text-align: center;
  border: 1px solid var(--color-border-subtle);
}

.auth-info strong {
  color: var(--color-text-muted);
  display: block;
  margin-bottom: 0.25rem;
}

/* ---------- Result / scan pages ---------- */

.result-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  max-width: 550px;
  width: 100%;
  border: 1px solid var(--color-border-subtle);
  text-align: center;
}

.result-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.result-card h1 {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  color: var(--color-text);
}

.result-stats {
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  font-weight: 500;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
}

/* ---------- Delete confirmation ---------- */

.delete-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  border: 1px solid var(--color-border-subtle);
}

.delete-card .warning-icon {
  font-size: 3.5rem;
  text-align: center;
  margin-bottom: 1rem;
}

.delete-card h1 {
  font-size: 1.25rem;
  text-align: center;
  margin: 0 0 1rem;
  color: var(--color-danger);
}

.page-info {
  background: var(--color-surface-alt);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.page-info p {
  margin: 0 0 0.4rem;
  color: var(--color-text-muted);
}

.page-info p:last-child {
  margin-bottom: 0;
}

.page-info strong {
  color: var(--color-text);
}

.warning-text {
  color: var(--color-danger);
  text-align: center;
  margin-bottom: 1.25rem;
  font-weight: 500;
  font-size: 0.85rem;
}

.delete-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 480px) {
  .delete-actions {
    grid-template-columns: 1fr;
  }
}

/* ---------- Preview page ---------- */

.preview-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.preview-toolbar {
  background: linear-gradient(90deg, rgba(15,23,42,0.98), rgba(15,23,42,0.96));
  border-bottom: 1px solid var(--color-header-border);
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.preview-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.preview-toolbar-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.preview-toolbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.device-buttons {
  display: flex;
  gap: 0.25rem;
  background: var(--color-surface-alt);
  padding: 0.15rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
}

.device-btn {
  padding: 0.35rem 0.65rem;
  background: transparent;
  color: var(--color-text-muted);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition-fast);
}

.device-btn:hover,
.device-btn.active {
  background: var(--color-primary);
  color: white;
}

.preview-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #1e293b;
  padding: 1rem;
  overflow: hidden;
}

.preview-frame-wrapper {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-med);
  width: 100%;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
}

.preview-frame-wrapper.mobile {
  max-width: 375px;
  height: 667px;
}

.preview-frame-wrapper.tablet {
  max-width: 768px;
  height: 100%;
}

.preview-frame-wrapper.desktop {
  max-width: 100%;
  height: 100%;
}

.preview-frame-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius-md);
}

/* ---------- Messages ---------- */

.msg {
  max-width: 700px;
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
}

.msg.error {
  color: #fecaca;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
}

.msg.success {
  color: #bbf7d0;
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(34,197,94,0.3);
}

.success-banner {
  background: var(--color-success);
  color: white;
  padding: 0.5rem 1rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ---------- Empty state ---------- */

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--color-text-soft);
}

.empty-state h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--color-text-muted);
}

.empty-state p {
  margin: 0;
}

/* ---------- Hidden iframe for screenshots ---------- */

.hidden-frame {
  position: absolute;
  left: -9999px;
  width: 1280px;
  height: 1024px;
  border: none;
}

/* ---------- Footer ---------- */

.app-footer {
  border-top: 1px solid var(--color-border-subtle);
  background: rgba(15,23,42,0.96);
  color: var(--color-text-soft);
  font-size: 0.75rem;
}

.app-footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.55rem 1.1rem 0.7rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
  .app-header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .app-nav {
    width: 100%;
  }

  .app-nav a,
  .app-nav button {
    flex: 1;
    justify-content: center;
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
  }

  .filters-grid {
    grid-template-columns: 1fr 1fr;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .controls-left,
  .controls-right {
    width: 100%;
    justify-content: space-between;
  }

  .editor-toolbar {
    flex-direction: column;
    gap: 0.5rem;
  }

  .editor-toolbar-actions {
    width: 100%;
  }

  .editor-toolbar-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .preview-toolbar {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }

  .preview-toolbar-left,
  .preview-toolbar-actions {
    justify-content: center;
  }

  .device-buttons {
    width: 100%;
    justify-content: center;
  }
}

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

  .filter-row {
    flex-direction: column;
  }

  .auth-card {
    padding: 1.5rem;
  }
}

/* ---------- Pagination Navigation ---------- */
.pagination-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
}

.pagination-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.pagination-btn:disabled {
  background: var(--color-text-soft);
  cursor: not-allowed;
  opacity: 0.5;
}

.pagination-info {
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 200px;
  text-align: center;
}

@media (max-width: 600px) {
  .pagination-nav {
    flex-direction: column;
    gap: 0.75rem;
  }

  .pagination-btn {
    width: 100%;
    justify-content: center;
  }

  .pagination-info {
    order: -1;
  }
}

/* ---------- Preview Modal ---------- */
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--color-page-bg);
  display: none;
  flex-direction: column;
}

.preview-modal.active {
  display: flex;
}

.preview-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--color-header-bg);
  border-bottom: 1px solid var(--color-header-border);
  gap: 1rem;
  flex-shrink: 0;
}

.preview-modal-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--color-text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-modal-title i {
  color: var(--color-primary);
  flex-shrink: 0;
}

.preview-modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.preview-device-buttons {
  display: flex;
  gap: 0.25rem;
  background: var(--color-surface);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  margin-right: 0.5rem;
}

.preview-device-btn {
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.preview-device-btn:hover {
  color: var(--color-text);
  background: rgba(255,255,255,0.05);
}

.preview-device-btn.active {
  background: var(--color-primary);
  color: white;
}

.preview-modal-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--color-surface-alt);
  overflow: hidden;
}

.preview-frame-container {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.preview-frame-container.desktop {
  width: 100%;
  height: 100%;
  max-width: 100%;
  border-radius: var(--radius-md);
}

.preview-frame-container.tablet {
  width: 768px;
  height: 100%;
  max-height: 1024px;
  border-radius: var(--radius-lg);
  border: 8px solid #333;
}

.preview-frame-container.mobile {
  width: 375px;
  height: 100%;
  max-height: 812px;
  border-radius: 2rem;
  border: 10px solid #333;
}

.preview-frame-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  flex: 1;
}

/* Responsive adjustments for preview modal */
@media (max-width: 768px) {
  .preview-modal-header {
    flex-direction: column;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .preview-modal-title {
    width: 100%;
    justify-content: center;
  }

  .preview-modal-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .preview-device-buttons {
    margin-right: 0;
  }

  .preview-modal-body {
    padding: 0.5rem;
  }

  .preview-frame-container.tablet,
  .preview-frame-container.mobile {
    max-width: 100%;
    max-height: calc(100vh - 140px);
  }
}

/* ---------- Admin Badge & Role Badges ---------- */

.badge-admin {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--color-primary);
  color: white;
  margin-left: 0.5rem;
}

.badge-user {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  margin-left: 0.5rem;
}

/* ---------- Drag & Drop Styles ---------- */

.drag-handle {
  background: linear-gradient(135deg, var(--color-primary), #4f46e5);
  color: white;
  padding: 0.4rem;
  text-align: center;
  cursor: grab;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  user-select: none;
  transition: background var(--transition-fast);
}

.drag-handle:hover {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
}

.drag-handle:active {
  cursor: grabbing;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
}

.drag-handle i {
  font-size: 1.1rem;
}

.sortable-ghost {
  opacity: 0.4;
}

.sortable-chosen {
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
  transform: scale(1.02);
}

.sortable-drag {
  opacity: 1;
}

/* ---------- Project Management Styles ---------- */

/* Status Filter List */
.status-filter-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.status-filter-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.status-filter-item:hover {
  background: rgba(255,255,255,0.05);
  text-decoration: none;
}

.status-filter-item.active {
  background: var(--color-primary-soft);
  color: var(--color-text);
}

.status-filter-item .badge {
  margin-left: auto;
  background: var(--color-surface-alt);
  padding: 0.1rem 0.4rem;
}

.status-filter-item i.text-success { color: var(--color-success); }
.status-filter-item i.text-primary { color: var(--color-primary); }
.status-filter-item i.text-muted { color: var(--color-text-soft); }

/* Project Status Badge */
.project-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.project-status-badge.status-active {
  background: rgba(34,197,94,0.15);
  color: #86efac;
  border: 1px solid rgba(34,197,94,0.3);
}

.project-status-badge.status-completed {
  background: rgba(37,99,235,0.15);
  color: #93c5fd;
  border: 1px solid rgba(37,99,235,0.3);
}

.project-status-badge.status-archived {
  background: rgba(107,114,128,0.15);
  color: #9ca3af;
  border: 1px solid rgba(107,114,128,0.3);
}

/* Project Stats */
.project-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Tabs Navigation */
.tabs-nav {
  display: flex;
  gap: 0.25rem;
  background: var(--color-surface);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  background: rgba(255,255,255,0.05);
  text-decoration: none;
}

.tab-btn.active {
  background: var(--color-primary);
  color: white;
}

.tab-count {
  background: rgba(255,255,255,0.2);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
}

.tab-btn.active .tab-count {
  background: rgba(255,255,255,0.25);
}

/* File Card - Compact with Thumbnail on Top */
.file-card {
  display: flex;
  flex-direction: column;
}

.file-card-icon {
  width: 100%;
  height: 100px;
  background: var(--color-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.file-card-icon i {
  font-size: 2rem;
  color: var(--color-text-soft);
}

.file-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
}

.file-card .card-content {
  padding: 0.6rem;
}

.file-card .card-title {
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.file-card .card-description {
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
  -webkit-line-clamp: 1;
}

.file-card .card-meta {
  font-size: 0.7rem;
  margin-bottom: 0.25rem;
}

.file-card .card-tags {
  margin-bottom: 0.25rem;
}

.file-card .card-tags .chip {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
}

.file-card .card-actions {
  margin-top: 0.25rem;
}

.file-card .card-actions .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

/* File Cards Grid - More compact layout */
.file-cards-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
}

@media (min-width: 640px) {
  .file-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .file-cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1400px) {
  .file-cards-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* File Type Badge */
.file-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.file-type-badge.file-type-html {
  background: rgba(249,115,22,0.15);
  color: #fdba74;
  border: 1px solid rgba(249,115,22,0.3);
}

.file-type-badge.file-type-pdf {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.3);
}

/* Comments */
.comment-item {
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--color-border-subtle);
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.comment-author {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text);
}

.comment-date {
  font-size: 0.75rem;
  color: var(--color-text-soft);
}

.comment-edited {
  font-style: italic;
  color: var(--color-text-soft);
}

.comment-content {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.comment-actions {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.comment-replies {
  margin-top: 0.75rem;
  margin-left: 1rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--color-border-subtle);
}

.comment-replies .comment-item {
  background: rgba(15,23,42,0.5);
}

.reply-form {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: rgba(15,23,42,0.5);
  border-radius: var(--radius-sm);
}

.reply-form textarea {
  margin-bottom: 0;
}

/* File View Layout */
.file-view-layout {
  display: flex;
  height: calc(100vh - 60px);
  overflow: hidden;
}

.file-preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-surface-alt);
  overflow: hidden;
}

.file-info-panel {
  width: 360px;
  flex-shrink: 0;
  padding: 1rem;
  overflow-y: auto;
  background: var(--color-page-bg);
  border-left: 1px solid var(--color-border-subtle);
}

.pdf-preview-container {
  flex: 1;
  background: #525659;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-info-content {
  font-size: 0.85rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border-subtle);
  gap: 0.5rem;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--color-text-soft);
  font-size: 0.8rem;
}

.info-value {
  color: var(--color-text);
  text-align: right;
  word-break: break-word;
}

@media (max-width: 1024px) {
  .file-view-layout {
    flex-direction: column;
    height: auto;
  }

  .file-preview-panel {
    height: 50vh;
    min-height: 300px;
  }

  .file-info-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--color-border-subtle);
  }
}

/* Project Header */
.project-header {
  margin-bottom: 1rem;
}

.project-header .panel-header {
  margin-bottom: 0.5rem;
}

/* Comment Form */
.comment-form textarea {
  min-height: 60px;
}

/* App Footer - Fixed Bottom */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--color-border-subtle);
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-soft);
  z-index: 100;
}

.app-footer i {
  margin-right: 0.35rem;
  color: var(--color-primary);
}

/* Add padding to main content to prevent footer overlap */
.app-shell {
  padding-bottom: 2.5rem;
}

.centered-layout {
  padding-bottom: 2.5rem;
}
