/*
 * TVS-PACS Dev Tools — Shared Styles
 * Used by: Oncura Simulator, and future dev tool pages.
 */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
}

/* ── Shell layout ── */
.devtools-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Top navbar ── */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: 56px;
    background: #0d1322;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 1rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    color: #f1f5f9;
    font-weight: 700;
    font-size: .95rem;
    white-space: nowrap;
}

.navbar-brand svg { flex-shrink: 0; }

.navbar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.navbar-brand-title { font-size: .95rem; font-weight: 700; color: #f1f5f9; }
.navbar-brand-sub   { font-size: .6rem; font-weight: 500; color: #64748b; letter-spacing: .08em; text-transform: uppercase; }

.navbar-divider {
    width: 1px; height: 28px;
    background: #334155;
    margin: 0 .25rem;
}

.navbar-page-title {
    font-size: .85rem;
    font-weight: 600;
    color: #94a3b8;
}

.navbar-spacer { flex: 1; }

.navbar-badge {
    display: inline-block;
    background: #dc2626;
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: .05em;
}

.navbar-env {
    font-size: .7rem;
    color: #64748b;
    font-family: 'Consolas', 'Fira Code', monospace;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 240px;
    background: #0d1322;
    border-right: 1px solid #1e293b;
    padding: 1.25rem 0;
    overflow-y: auto;
    z-index: 90;
    display: flex;
    flex-direction: column;
}

.sidebar-section {
    padding: 0 .75rem;
    margin-bottom: 1.5rem;
}

.sidebar-heading {
    font-size: .65rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .1em;
    padding: 0 .75rem;
    margin-bottom: .5rem;
}

.sidebar-nav { list-style: none; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .75rem;
    border-radius: 8px;
    text-decoration: none;
    color: #94a3b8;
    font-size: .82rem;
    font-weight: 500;
    transition: all .15s;
}

.sidebar-link:hover {
    background: #1e293b;
    color: #e2e8f0;
}

.sidebar-link.active {
    background: #1e3a5f;
    color: #38bdf8;
}

.sidebar-link svg {
    flex-shrink: 0;
    opacity: .7;
}

.sidebar-link.active svg,
.sidebar-link:hover svg {
    opacity: 1;
}

.sidebar-link-badge {
    margin-left: auto;
    font-size: .65rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: #334155;
    color: #94a3b8;
}

.sidebar-link.active .sidebar-link-badge {
    background: #1e40af;
    color: #93c5fd;
}

/* ── Main content ── */
.main-content {
    margin-left: 240px;
    margin-top: 56px;
    padding: 2rem;
    flex: 1;
    min-height: calc(100vh - 56px);
}

.container { max-width: 960px; margin: 0 auto; }

/* ── Page header ── */
.page-header { margin-bottom: 1.75rem; }

.page-header h1 {
    font-size: 1.4rem;
    margin-bottom: .25rem;
    color: #f1f5f9;
}

.page-header .subtitle {
    color: #94a3b8;
    font-size: .82rem;
    margin-bottom: 0;
}

/* ── Card ── */
.card {
    background: #1e293b; border: 1px solid #334155;
    border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem;
}
.card-title {
    font-size: 1rem; font-weight: 600;
    margin-bottom: 1rem; color: #f1f5f9;
}

/* ── Form ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group.full { grid-column: 1 / -1; }

label { font-size: .8rem; font-weight: 500; color: #94a3b8; }

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"] {
    background: #0f172a; border: 1px solid #475569; border-radius: 8px;
    padding: .6rem .75rem; color: #e2e8f0;
    font-size: .85rem; font-family: 'Consolas', 'Fira Code', monospace;
    transition: border-color .2s;
}
input:focus { outline: none; border-color: #38bdf8; }
input:read-only { opacity: .6; }

/* ── Checkbox ── */
.checkbox-row { display: flex; align-items: center; gap: .5rem; padding-top: .5rem; }
.checkbox-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: #38bdf8; }
.checkbox-row label { color: #e2e8f0; font-size: .85rem; }

/* ── Buttons ── */
.btn-row { display: flex; gap: .75rem; margin-top: 1.25rem; flex-wrap: wrap; }

button, .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .6rem 1.25rem; border: none; border-radius: 8px;
    font-size: .85rem; font-weight: 600; cursor: pointer;
    transition: all .15s; white-space: nowrap;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-secondary { background: #475569; color: #e2e8f0; }
.btn-secondary:hover { background: #64748b; }
.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }

/* ── Output ── */
.output-box {
    background: #0f172a; border: 1px solid #334155; border-radius: 8px;
    padding: 1rem; margin-top: .75rem;
    font-family: 'Consolas', 'Fira Code', monospace;
    font-size: .8rem; line-height: 1.6;
    word-break: break-all; white-space: pre-wrap;
    max-height: 300px; overflow-y: auto;
}

.url-preview {
    background: #172554; border: 1px solid #1e40af; border-radius: 8px;
    padding: 1rem; margin-top: .75rem;
    font-family: 'Consolas', monospace; font-size: .8rem;
    word-break: break-all; color: #93c5fd;
}
.url-preview a { color: #60a5fa; text-decoration: underline; }

/* ── Status ── */
.status { padding: .75rem 1rem; border-radius: 8px; margin-top: .75rem; font-size: .85rem; }
.status-success { background: #064e3b; border: 1px solid #059669; color: #6ee7b7; }
.status-error   { background: #450a0a; border: 1px solid #dc2626; color: #fca5a5; }
.status-info    { background: #172554; border: 1px solid #2563eb; color: #93c5fd; }
.status-redirect { background: #422006; border: 1px solid #d97706; color: #fcd34d; }

/* ── Steps ── */
.steps { display: flex; gap: .5rem; margin-bottom: 1.5rem; }

.step {
    display: flex; align-items: center; gap: .4rem;
    padding: .35rem .75rem; border-radius: 20px;
    font-size: .75rem; font-weight: 600;
    background: #334155; color: #94a3b8;
}
.step.active { background: #1e40af; color: #fff; }
.step.done   { background: #064e3b; color: #6ee7b7; }

.step-num {
    width: 20px; height: 20px; border-radius: 50%;
    background: #475569; display: flex;
    align-items: center; justify-content: center; font-size: .7rem;
}
.step.active .step-num { background: #3b82f6; }
.step.done   .step-num { background: #10b981; }

/* ── Mapping info ── */
.mapping-info {
    display: grid; grid-template-columns: auto 1fr;
    gap: .25rem .75rem; margin-top: .75rem;
    font-size: .8rem; padding: .75rem 1rem;
    background: #172554; border: 1px solid #1e40af; border-radius: 8px;
}
.mapping-info dt { color: #94a3b8; font-weight: 600; }
.mapping-info dd { color: #93c5fd; font-family: 'Consolas', monospace; word-break: break-all; }

/* ── Spinner ── */
.spinner {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid #94a3b8; border-top-color: transparent;
    border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Table ── */
.headers-table { width: 100%; border-collapse: collapse; margin-top: .5rem; font-size: .75rem; }
.headers-table th { text-align: left; color: #94a3b8; padding: .25rem .5rem; border-bottom: 1px solid #334155; }
.headers-table td {
    color: #e2e8f0; padding: .25rem .5rem; border-bottom: 1px solid #1e293b;
    font-family: monospace; word-break: break-all;
}

/* ── Hint text ── */
.hint { font-size: .75rem; color: #64748b; margin-top: .5rem; }

/* ── Viewer iframe ── */
.viewer-iframe-wrapper { padding: 0; overflow: hidden; }

.viewer-iframe-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: .75rem 1rem; background: #1e293b; border-bottom: 1px solid #334155;
}
.viewer-iframe-toolbar span {
    font-size: .85rem; font-weight: 600; color: #f1f5f9;
}

.viewer-iframe {
    width: 100%; height: 700px; border: none; background: #000;
}

/* ── Divider ── */
hr { border: none; border-top: 1px solid #334155; margin: 1.5rem 0; }

/* ── Footer ── */
.devtools-footer {
    text-align: center;
    color: #334155;
    font-size: .7rem;
    margin-top: 3rem;
    padding-bottom: 1rem;
}

/* ── Responsive: collapse sidebar on small screens ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
}
