/* ─────────── GLOBAL STYLES ─────────── */
*{box-sizing:border-box} 
html, body { margin: 0; height: 100%; }

:root {
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color:#0f172a;
  line-height: 1.4;
}

body{
  margin:0;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color:#0f172a;
  min-height:100vh;
  background:#ffffff;
}

h1{margin:0}

/* ─────────── TYPOGRAPHY SYSTEM ─────────── */
/* Font Style 1: Large Headings */
.font-heading-large {
  font-size: 2.25rem; /* 36px */
  font-weight: 700;
  line-height: 1.2;
}

/* Font Style 2: Medium Headings */
.font-heading-medium {
  font-size: 1.75rem; /* 28px */
  font-weight: 600;
  line-height: 1.3;
}

/* Font Style 2b: Small Headings */
.font-heading-small {
  font-size: 1.5rem; /* 24px */
  font-weight: 600;
  line-height: 1.3;
}

/* Font Style 3: Body Text (Default 14px) */
.font-body {
  font-size: 1rem; /* 16px */
  font-weight: 400;
  line-height: 1.5;
}

/* Font Style 3b: UI Elements (Buttons, Inputs, Selects) */
.font-ui {
  font-size: 1rem; /* 16px */
  font-weight: 500;
  line-height: 1.4;
}

/* Font Style 3c: Labels */
.font-label {
  font-size: 0.875rem; /* 14px */
  font-weight: 600;
  line-height: 1.4;
}

/* Font Style 4: Small Text */
.font-small {
  font-size: 0.75rem; /* 12px */
  font-weight: 500;
  line-height: 1.4;
}

/* Font Style 5: Extra Small Text */
.font-extra-small {
  font-size: 0.625rem; /* 10px */
  font-weight: 500;
  line-height: 1.4;
}

/* ─────────── MAIN APPLICATION LAYOUT ─────────── */
body { 
  display: flex; 
  flex-direction: column; 
  height: 100vh; 
  margin: 0; 
}

.app-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem 2rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto;
}

.app-title h1 {
  margin: 0;
}

.app-subtitle {
  margin: 0.25rem 0 0 0;
  opacity: 0.9;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
}

.theme-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-top: 0;
}

.theme-btn:hover {
  background: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.5);
}

.theme-icon {
  width: 20px;
  height: 20px;
  transition: all 0.2s;
}

.theme-icon.hidden {
  display: none;
}

.welcome-text {
  font-size: 1rem;
  font-weight: 500;
}

.logout-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0;
  font-size: 1rem;
  font-weight: 500;
}

.logout-btn:hover {
  background: rgba(255,255,255,0.3);
}

.container { 
  display: flex; 
  flex: 1; 
  overflow: hidden; 
}

/* ─────────── FORM PANEL ─────────── */
.form-area {
  flex: 1;
  min-width: 320px;
  max-width: 400px;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  padding: 0;
}

.form-header {
  background: white;
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-header h2 {
  margin: 0;
  color: #1e293b;
}

.form-header .primary-btn {
  margin-top: 0;
  padding: 0.75rem 1.5rem;
  white-space: nowrap;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
}

.primary-btn {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
}

.primary-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.secondary-btn {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.secondary-btn:hover {
  background: #e2e8f0;
}


/* ─────────── CONTENT AREA ─────────── */
.content-area {
  flex: 2;
  display: flex;
  flex-direction: column;
  background: white;
  overflow: hidden;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.content-header h3 {
  margin: 0;
  color: #1e293b;
}

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

.assets-container {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
}

/* ─────────── JSON DEBUG SECTION ─────────── */
.json-debug {
  margin-top: 2rem;
  border-top: 1px solid #e2e8f0;
  padding-top: 1.5rem;
}

.json-section {
  margin-bottom: 1.5rem;
}

.json-section h4 {
  margin: 0 0 0.75rem 0;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.json-content {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 1rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  line-height: 1.4;
  color: #374151;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #dcfce7;
  color: #166534;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
}

.status-indicator::before {
  content: "●";
  color: #22c55e;
}

/* ─────────── TABS ─────────── */
.tabs {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 1.5rem;
}

.tab-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab-button:hover {
  color: #475569;
  background: #f1f5f9;
}

.tab-button.active {
  color: #3b82f6;
  background: white;
  border-bottom-color: #3b82f6;
  font-weight: 600;
}

.tab-icon {
}

.tab-content-wrapper {
  flex: 1;
  overflow: hidden;
}

.tab-content {
  display: none;
  height: 100%;
  overflow: auto;
  background: white;
}

.tab-content.active {
  display: block;
}

.tab-content .content-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  background: white;
}

.tab-content .content-header h4 {
  margin: 0;
  color: #1e293b;
}

.copy-btn {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: #e2e8f0;
}

.asset-count {
  background: #dbeafe;
  color: #1e40af;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
}


/* ─────────── FORM WIDGETS ─────────── */
.form-area form {
  padding: 1.5rem;
}

/* ─────────── SYMBOLS SECTION ─────────── */
.symbols-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.symbol-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s;
}

.symbol-row:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.symbol-role {
  flex: 0 0 90px;
  min-width: 90px;
}

.symbol-label {
  flex: 1;
  min-width: 0;
}

.symbol-label input {
  margin: 0;
  padding: 0.5rem 0.75rem;
}

.symbol-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.delete-symbol-btn {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: 0;
  font-size: 1rem;
  font-weight: 500;
}

.delete-symbol-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.add-symbol-btn {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  font-size: 1rem;
  font-weight: 500;
}

.add-symbol-btn:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

/* ─────────── BACKGROUNDS SECTION ─────────── */
.backgrounds-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.background-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s;
}

.background-row:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.background-role {
  flex: 0 0 120px;
  min-width: 120px;
}

.background-label {
  flex: 1;
  min-width: 0;
}

.background-label input {
  margin: 0;
  padding: 0.5rem 0.75rem;
}

.background-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.delete-background-btn {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: 0;
  font-size: 1rem;
  font-weight: 500;
}

.delete-background-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.add-background-btn {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  font-size: 1rem;
  font-weight: 500;
}

.add-background-btn:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

fieldset { 
  border: 1px solid #e2e8f0; 
  margin-bottom: 1.5rem; 
  padding: 1.25rem; 
  border-radius: 8px;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

legend { 
  font-weight: 600; 
  color: #374151;
  padding: 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

label { 
  display: block; 
  margin: 0.75rem 0 0.5rem 0; 
  font-weight: 500;
  color: #374151;
}
.row-inline { display: flex; gap: .5rem; }
.row-inline label { flex: 1; }
input[type="text"],
textarea,
select,
input[type="number"] { width: 100%; box-sizing: border-box; }

table      { width: 100%; border-collapse: collapse; }
th, td     { border: 1px solid #ccc; padding: .3rem; }

/* ─────────── FORM ELEMENTS ─────────── */
label{display:block;margin:14px 0 6px;font-size: 0.875rem;font-weight: 600}

input{
  padding:12px 14px;
  border:1px solid #e5e7eb;
  border-radius:12px;
  background:#fff;
  color:#0f172a;
  font-size: 1rem;
  font-weight: 500;
}
input[type="email"],
input[type="password"] {
  width:100%;
}
input::placeholder{color:#94a3b8}
input:focus-visible{outline:3px solid rgba(37,99,235,.35);outline-offset:2px;border-color:#bfdbfe}

button{
  margin-top:16px;
  padding:12px 14px;
  border:0;
  border-radius:12px;
  background:#2563eb;
  color:#fff;
  font-size: 1rem;
  font-weight:700;
  cursor:pointer;
  display:block;
}
button:focus-visible{outline:3px solid rgba(37,99,235,.5);outline-offset:2px}
button      { cursor: pointer; }
.delete-btn { background: #ffebe9; border: 1px solid #e55347; cursor: pointer; }

select.role {      
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  font-size: 1rem;
  font-weight: 500;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 32px;
}

select.role:hover {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

select.role:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ─────────── LOGIN PAGE STYLES ─────────── */

.wrap{
  min-height:100vh;
  display:grid;
  place-items:center;
}

.card{
  width:100%;
  max-width:420px;
  background:#ffffff;
  border-radius:16px;
  padding:24px;
}

.hint{margin:0 0 16px;color:#64748b}

#message{margin-top:10px;min-height:1.25em;color:#801433}

/* ─────────── LOGIN FORM LAYOUT ─────────── */

/* Desktop: split layout with right-side hero image */
.art{display:none} /* hidden on mobile */
@media (min-width: 992px){
  body{background:#ffffff}
  .wrap{
    height:100vh;
    grid-template-columns:minmax(380px,520px) 1fr;
    gap:clamp(32px,96px);
    align-items:center;
    padding:clamp(32px,72px);
  }
  .art{
    display:block;
    height:100vh;
    width:100%;
    position:relative;
    overflow:hidden;
  }
  .art img{
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100%;
    object-fit:cover;
    object-position:center;
    display:block;
  }
}

/* ─────────── DYNAMIC STYLES FROM JS ─────────── */
/* Styles for dynamically generated content */
#thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

#thumbs figure {
  text-align: center;
}

#thumbs figcaption {
}

/* ─────────── ASSETS GRID ─────────── */
.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
}

.assets-grid figure {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.assets-grid figure:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.assets-grid img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.assets-grid figcaption {
  color: #64748b;
  line-height: 1.4;
}

/* ─────────── LOADING ANIMATIONS ─────────── */
.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 2rem;
}

.loading-spinner-large {
  width: 60px;
  height: 60px;
  border: 4px solid #f3f4f6;
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

.loading-text-large {
  color: #6b7280;
  text-align: center;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


/* ─────────── RESPONSIVE DESIGN ─────────── */
@media (max-width: 1024px) {
  .container {
    flex-direction: column;
  }
  
  .form-area {
    max-width: none;
    min-width: auto;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }
  
  .header-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .user-info {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 1rem;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .tabs {
    padding: 0 1rem;
  }
  
  .tab-button {
    padding: 0.75rem 1rem;
  }
  
  .assets-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .app-title h1 {
  }
  
  .form-header h2 {
  }
  
  .assets-grid {
    grid-template-columns: 1fr;
  }
}

/* ─────────── DARK THEME ─────────── */
[data-theme="dark"] {
  color-scheme: dark;
}

[data-theme="dark"] body {
  background: #0f172a;
  color: #f1f5f9;
}

[data-theme="dark"] .app-header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

[data-theme="dark"] .form-area {
  background: #1e293b;
  border-right: 1px solid #334155;
}

[data-theme="dark"] .content-area {
  background: #0f172a;
}

[data-theme="dark"] .form-header {
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

[data-theme="dark"] .content-header {
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

[data-theme="dark"] .content-header h3 {
  color: #f1f5f9;
}

[data-theme="dark"] fieldset {
  border: 1px solid #334155;
  background: #1e293b;
}

[data-theme="dark"] legend {
  color: #cbd5e1;
}

[data-theme="dark"] label {
  color: #e2e8f0;
}

[data-theme="dark"] input {
  background: #334155;
  border: 1px solid #475569;
  color: #f1f5f9;
}

[data-theme="dark"] input::placeholder {
  color: #94a3b8;
}

[data-theme="dark"] input:focus-visible {
  border-color: #3b82f6;
  outline-color: rgba(59, 130, 246, 0.35);
}

[data-theme="dark"] select.role {
  background: #334155;
  border: 1px solid #475569;
  color: #f1f5f9;
}

[data-theme="dark"] select.role:hover {
  border-color: #3b82f6;
}


[data-theme="dark"] button {
  background: #3b82f6;
  color: white;
}

[data-theme="dark"] .primary-btn {
  background: #3b82f6;
  color: white;
}

[data-theme="dark"] .primary-btn:hover {
  background: #2563eb;
}

[data-theme="dark"] .logout-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
}

[data-theme="dark"] .logout-btn:hover {
  background: rgba(255,255,255,0.2);
}

[data-theme="dark"] .symbol-row {
  background: #334155;
  border: 1px solid #475569;
}

[data-theme="dark"] .symbol-row:hover {
  background: #475569;
  border-color: #64748b;
}

[data-theme="dark"] .background-row {
  background: #334155;
  border: 1px solid #475569;
}

[data-theme="dark"] .background-row:hover {
  background: #475569;
  border-color: #64748b;
}

[data-theme="dark"] .delete-symbol-btn {
  background: #dc2626;
  color: white;
  border: 1px solid #dc2626;
}

[data-theme="dark"] .delete-symbol-btn:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

[data-theme="dark"] .delete-background-btn {
  background: #dc2626;
  color: white;
  border: 1px solid #dc2626;
}

[data-theme="dark"] .delete-background-btn:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

[data-theme="dark"] .add-symbol-btn {
  background: #1e40af;
  color: white;
  border: 1px solid #1e40af;
}

[data-theme="dark"] .add-symbol-btn:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

[data-theme="dark"] .add-background-btn {
  background: #1e40af;
  color: white;
  border: 1px solid #1e40af;
}

[data-theme="dark"] .add-background-btn:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

[data-theme="dark"] .status-indicator {
  background: #065f46;
  color: #10b981;
}

[data-theme="dark"] .asset-count {
  background: #1e40af;
  color: #60a5fa;
}

[data-theme="dark"] .assets-container {
  background: #0f172a;
}

[data-theme="dark"] .assets-grid figure {
  background: #334155;
  border: 1px solid #475569;
}

[data-theme="dark"] .assets-grid figcaption {
  color: #94a3b8;
}

[data-theme="dark"] .json-debug {
  background: #1e293b;
  border: 1px solid #334155;
}

[data-theme="dark"] .json-section h4 {
  color: #cbd5e1;
}

[data-theme="dark"] .json-content {
  background: #334155;
  border: 1px solid #475569;
  color: #f1f5f9;
}

[data-theme="dark"] .loading-center {
  background: #1e293b;
}

[data-theme="dark"] .loading-text-large {
  color: #cbd5e1;
}

[data-theme="dark"] .loading-spinner-large {
  border: 4px solid #334155;
  border-top: 4px solid #3b82f6;
}