/* Fuze App Directory — styles (adapted from Fuzebilling portal) */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --navy-950: #0a0f1a;
  --navy-900: #0d1321;
  --navy-800: #131a2e;
  --navy-700: #1a2332;
  --navy-600: #242d3d;
  --navy-500: #2e3a4e;

  --accent: #22d3ee;
  --accent-dim: #0e7490;
  --accent-glow: rgba(34, 211, 238, 0.3);
  --accent-bg: rgba(34, 211, 238, 0.1);

  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.15);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.15);
  --orange: #f59e0b;
  --orange-bg: rgba(245, 158, 11, 0.15);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.15);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--text-primary);
  background: var(--navy-950);
  line-height: 1.5;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--navy-900); }
::-webkit-scrollbar-thumb { background: var(--navy-600); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--navy-500); }

/* ---- Nav ---- */
.nav {
  background: var(--navy-900);
  border-bottom: 1px solid var(--navy-600);
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo { height: 24px; width: auto; }

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ---- Layout ---- */
.container {
  max-width: min(96vw, 1800px);
  margin: 0 auto;
  padding: 24px;
}

.page-header { margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.page-header .subtitle { font-size: 13px; color: var(--text-tertiary); margin-top: 4px; }

/* ---- Cards ---- */
.card {
  background: var(--navy-800);
  border: 1px solid var(--navy-600);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left;
  padding: 10px 12px;
  background: var(--navy-700);
  color: var(--text-tertiary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--navy-600);
  color: var(--text-secondary);
  vertical-align: middle;
}

td a { color: var(--accent); text-decoration: none; word-break: break-all; }
td a:hover { text-decoration: underline; }

td.app-name { color: var(--text-primary); font-weight: 600; }

tr:hover { background: var(--navy-700); }

.actions-row { display: flex; gap: 6px; justify-content: flex-end; }
.actions-row .btn { padding: 4px 10px; font-size: 11px; }

/* ---- Status pill ---- */
.status-pill {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid;
}
/* ---- Search + filter bar ---- */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--navy-800);
  border: 1px solid var(--navy-600);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input::placeholder { color: var(--text-tertiary); }
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--navy-800);
  border: 1px solid var(--navy-600);
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.filter-chip:hover {
  background: var(--navy-700);
  color: var(--text-primary);
}
.filter-chip.active {
  background: var(--accent-bg);
  border-color: rgba(34, 211, 238, 0.4);
  color: var(--accent);
}
.filter-chip .count {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 9999px;
  background: var(--navy-700);
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.filter-chip.active .count {
  background: rgba(34, 211, 238, 0.2);
  color: var(--accent);
}

/* ---- App grid ---- */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.app-card {
  background: var(--navy-800);
  border: 1px solid var(--navy-600);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  text-align: left;
}
.app-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 20px var(--accent-glow);
  transform: translateY(-2px);
}
.app-card:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.app-card-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.app-card-icon, .app-card-icon-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  flex-shrink: 0;
  background: var(--navy-700);
  border: 1px solid var(--navy-600);
}
.app-card-icon { object-fit: cover; }
.app-card-icon-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 22px;
  font-weight: 700;
}

.app-card-title {
  flex: 1;
  min-width: 0;
}
.app-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  word-break: break-word;
}
.app-card-owner {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 500;
}

.app-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 58px;
}

.app-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 26, 0.7);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--navy-800);
  border: 1px solid var(--navy-600);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--navy-600);
}
.modal-icon, .modal-icon-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  flex-shrink: 0;
  background: var(--navy-700);
  border: 1px solid var(--navy-600);
}
.modal-icon { object-fit: cover; }
.modal-icon-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 28px;
  font-weight: 700;
}
.modal-title {
  flex: 1;
  min-width: 0;
}
.modal-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.2px;
  word-break: break-word;
}
.modal-close {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}
.modal-close:hover { background: var(--navy-700); color: var(--text-primary); }

.modal-body { padding: 20px 24px; }
.modal-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.meta-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.meta-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  font-size: 13px;
}
.meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-tertiary);
  font-weight: 600;
  width: 80px;
  flex-shrink: 0;
}
.meta-val { color: var(--text-primary); word-break: break-word; min-width: 0; }
.meta-val a { color: var(--accent); text-decoration: none; }
.meta-val a:hover { text-decoration: underline; }
.meta-val.muted { color: var(--text-tertiary); }

.modal-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--navy-600);
  justify-content: flex-end;
}
.modal-footer .btn-primary { margin-right: auto; }

/* ---- Icons ---- */
.icon-picker {
  display: flex;
  align-items: center;
  gap: 12px;
}
.icon-preview {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: var(--navy-700);
  border: 1px solid var(--navy-600);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.icon-placeholder {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.icon-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
input[type="file"] {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: var(--navy-700);
  border: 1px solid var(--navy-600);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="file"]:hover { border-color: var(--navy-500); }
input[type="file"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input[type="file"]::file-selector-button {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid rgba(34, 211, 238, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  margin-right: 10px;
  cursor: pointer;
  transition: background 0.12s;
}
input[type="file"]::file-selector-button:hover {
  background: rgba(34, 211, 238, 0.2);
}

.label-hint {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  margin-left: 4px;
}

.screenshots-editor {
  display: flex;
  align-items: center;
  gap: 12px;
}
.screenshots-editor input[type="file"] { font-size: 12px; }

.screenshot-thumbs {
  display: flex;
  gap: 6px;
  height: 56px;
  min-width: 56px;
  padding: 4px;
  border: 1px solid var(--navy-600);
  border-radius: var(--radius-sm);
  background: var(--navy-700);
  flex-shrink: 0;
  overflow-x: auto;
}
.screenshot-thumbs:empty::before {
  content: 'No shots';
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
}
.screenshot-thumb {
  position: relative;
  width: 72px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--navy-600);
  background: var(--navy-800);
}
.screenshot-thumb img { width: 100%; height: 100%; object-fit: cover; }
.screenshot-thumb .screenshot-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(10, 15, 26, 0.9);
  border: 1px solid var(--navy-600);
  color: var(--text-primary);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.screenshot-thumb .screenshot-remove:hover { background: var(--red-bg); color: var(--red); border-color: rgba(239, 68, 68, 0.4); }
.screenshot-thumb.uploading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 26, 0.6);
  border-radius: 8px;
}
.screenshot-thumb.uploading::before {
  content: 'Uploading…';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  z-index: 1;
}

/* Screenshots in modal */
.modal-screenshots {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 20px;
  scroll-snap-type: x mandatory;
}
.modal-screenshots::-webkit-scrollbar { height: 6px; }
.modal-screenshot {
  flex-shrink: 0;
  width: 260px;
  height: 160px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--navy-600);
  background: var(--navy-700);
  cursor: zoom-in;
  scroll-snap-align: start;
  padding: 0;
}
.modal-screenshot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.modal-screenshot:hover img { transform: scale(1.04); }

/* Lightbox */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 26, 0.92);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: zoom-out;
  animation: fadeIn 0.15s ease;
}
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}

.table-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
  background: var(--navy-700);
  border: 1px solid var(--navy-600);
}
.table-icon-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--navy-700);
  border: 1px solid var(--navy-600);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 700;
}

.status-production { background: var(--green-bg); color: var(--green); border-color: rgba(34, 197, 94, 0.3); }
.status-testing { background: var(--orange-bg); color: var(--orange); border-color: rgba(245, 158, 11, 0.3); }
.status-development { background: var(--accent-bg); color: var(--accent); border-color: rgba(34, 211, 238, 0.3); }
.status-initiative { background: var(--blue-bg); color: var(--blue); border-color: rgba(59, 130, 246, 0.3); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: rgba(34, 211, 238, 0.3);
}
.btn-primary:hover { background: rgba(34, 211, 238, 0.2); box-shadow: 0 0 12px var(--accent-glow); }

.btn-secondary {
  background: var(--navy-700);
  color: var(--text-secondary);
  border-color: var(--navy-600);
}
.btn-secondary:hover { background: var(--navy-600); color: var(--text-primary); }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

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

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--navy-700);
  border: 1px solid var(--navy-600);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-tertiary); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group select option { background: var(--navy-800); color: var(--text-primary); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 600; }
.empty-state p { margin-bottom: 16px; font-size: 13px; }

/* ---- Toasts ---- */
.toast-container {
  position: fixed;
  top: 68px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--navy-800);
  border: 1px solid var(--navy-600);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-primary);
  animation: slideIn 0.3s ease;
  border-left: 3px solid var(--accent);
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

.footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--navy-600);
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
  letter-spacing: 0.3px;
}

@media (max-width: 768px) {
  .nav { padding: 0 16px; }
  .container { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  table { font-size: 12px; }
  th, td { padding: 8px; }
}
