/* ============================================================
   ARCHITECTURE SCHEMA — STILE CONDIVISO
   ============================================================
   Stile base condiviso da tutte le pagine *_architecture.php
   (samsung_architecture.php, brightsign_architecture.php, ecc.)

   Le pagine includono questo file con:
   <link rel="stylesheet" href="design/architecture-schema.css">

   I font Poppins e Muli sono caricati da design/header.php.
   JetBrains Mono è importato qui sotto.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --brand:     #E2007E;
  --bg:        #f8f9fa;
  --surface:   #ffffff;
  --surface-2: #f0f2f5;
  --border:    #dee2e6;
  --text:      #373a3c;
  --text-dim:  #9B9B9B;
  --red:       #D0021B;
  --purple:    #7c3aed;
  --mono:      'JetBrains Mono', monospace;
  --radius-sm: 4px;
  --radius:    8px;
}

/* ── Scroll isolation ── */
body { overflow: hidden; }
.layout-content { height: 100vh; overflow-y: auto; scroll-behavior: smooth; }

/* ── Schema Nav (tab navigation unica delle pagine architecture) ── */
.schema-nav { position: sticky; top: 0; z-index: 100; background: var(--surface); border-bottom: 1px solid var(--border); backdrop-filter: blur(12px); }
.schema-nav .container { display: flex; overflow-x: auto; scrollbar-width: none; }
.schema-nav .container::-webkit-scrollbar { display: none; }
.schema-nav button { background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; color: var(--text-dim); font-size: 0.75rem; font-weight: 500; padding: 0.75rem 1rem; white-space: nowrap; transition: color 0.2s, border-color 0.2s; }
.schema-nav button:hover  { color: var(--text); }
.schema-nav button.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ── Sections ── */
.section { padding: 3rem 0; border-bottom: 1px solid var(--border); scroll-margin-top: 3.5rem; }
.section:last-child  { border-bottom: none; }
.section-header      { margin-bottom: 1.5rem; }
.section-number      { font-family: var(--mono); font-size: 0.7rem; color: var(--brand); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.25rem; }
.section-header h2   { font-family: 'Poppins', sans-serif; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 0.5rem; }
.section-header p    { color: var(--text-dim); font-size: 0.85rem; max-width: 700px; margin-bottom: 0; }
.diagram-card pre    { margin: 0; } /* override Bootstrap pre margin */

/* ── Grid a due colonne ── */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1.5rem; }
@media (max-width: 768px) {
  .cols { grid-template-columns: 1fr; }
  .schema-nav a { font-size: 0.7rem; padding: 0.6rem 0.7rem; }
}

/* ── Footer (override app.css position:fixed) ── */
footer { position: static; width: auto; background: transparent; padding: 2rem 0; text-align: center; color: var(--text-dim); font-size: 0.75rem; border-top: 1px solid var(--border); margin-bottom: 3rem; }

/* ── Note ── */
.note          { background: var(--surface-2); border-left: 3px solid var(--brand); padding: 0.75rem 1rem; margin-top: 1rem; font-size: 0.8rem; color: var(--text-dim); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.note strong   { color: var(--text); }

/* ── Info Table (.table .table-sm da Bootstrap per base) ── */
.info-table            { margin-top: 1rem; }
.info-table th         { text-align: left; color: var(--text-dim); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.info-table td:first-child { font-family: var(--mono); font-size: 0.75rem; color: var(--brand); white-space: nowrap; }

/* ── Tag protocollo ── */
.tag      { display: inline-block; font-family: var(--mono); font-size: 0.65rem; padding: 0.1rem 0.4rem; border-radius: var(--radius-sm); margin-right: 0.3rem; }
.tag-rest { background: #d1fae5; color: #059669; }
.tag-ws   { background: #fef3c7; color: #d97706; }
.tag-mqtt { background: #ede9fe; color: var(--purple); }
.tag-safe { background: #fee2e2; color: var(--red); }
.tag-sse  { background: #dbeafe; color: #2563eb; }
.tag-tcp  { background: #fce7f3; color: #db2777; }
.tag-udp  { background: #e0e7ff; color: #4f46e5; }

/* ── Legend ── */
.legend      { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; color: var(--text-dim); }
.legend-dot  { width: 8px; height: 8px; border-radius: 2px; }

/* ── Diagram Card (.card Bootstrap per base) ── */
.diagram-card                { border-color: var(--border); border-radius: var(--radius); padding: 2rem; overflow: hidden; }
.diagram-card .mermaid       { display: flex; justify-content: center; }
.diagram-card .mermaid svg   { max-width: 100%; height: auto; }

/* ── Zoom Viewport ── */
.diagram-viewport             { overflow: hidden; cursor: grab; position: relative; min-height: 200px; }
.diagram-viewport.dragging    { cursor: grabbing; }
.diagram-viewport .mermaid-inner { transform-origin: 0 0; transition: none; will-change: transform; }

/* ── Zoom Toolbar ── */
.diagram-toolbar              { display: flex; align-items: center; gap: 0.4rem; position: absolute; top: 0.6rem; right: 0.6rem; z-index: 10; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0.25rem 0.4rem; opacity: 0.55; transition: opacity 0.2s; }
.diagram-card:hover .diagram-toolbar { opacity: 1; }
.diagram-toolbar button       { background: none; border: 1px solid var(--border); color: var(--text-dim); font-family: var(--mono); font-size: 0.7rem; width: 26px; height: 26px; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.diagram-toolbar button:hover { background: var(--border); color: var(--text); }
.diagram-toolbar .zoom-fit    { font-size: 0.6rem; }
.diagram-toolbar .zoom-level  { font-family: var(--mono); font-size: 0.65rem; color: var(--text-dim); min-width: 36px; text-align: center; user-select: none; }
.diagram-toolbar .zoom-fullscreen .material-icons { font-size: 16px; line-height: 1; }
.diagram-toolbar .zoom-divider { width: 1px; height: 16px; background: var(--border); margin: 0 0.1rem; }

/* ── Fullscreen Mode ── */
body.diagram-fullscreen-active           { overflow: hidden; }
.diagram-fullscreen-backdrop             { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 9998; opacity: 0; transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1); backdrop-filter: blur(2px); }
.diagram-fullscreen-backdrop.visible     { opacity: 1; }
.diagram-card.is-fullscreen              { position: fixed; z-index: 9999; display: flex; flex-direction: column; background: var(--surface); transition: top 0.28s cubic-bezier(0.4, 0, 0.2, 1), left 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s cubic-bezier(0.4, 0, 0.2, 1), height 0.28s cubic-bezier(0.4, 0, 0.2, 1), border-radius 0.28s cubic-bezier(0.4, 0, 0.2, 1); }
.diagram-card.is-fullscreen.expanding    { top: 2vh !important; left: 2vw !important; width: 96vw !important; height: 96vh !important; border-radius: var(--radius); }
.diagram-card.is-fullscreen .diagram-toolbar { opacity: 1; }
.diagram-card.is-fullscreen .diagram-viewport { flex: 1; min-height: 0; height: auto; }

/* ── Loading / Error ── */
.diagram-placeholder         { display: flex; align-items: center; justify-content: center; min-height: 200px; color: var(--text-dim); font-size: 0.8rem; gap: 0.5rem; }
.diagram-placeholder .spinner{ width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; }
.diagram-placeholder--error  { color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }