/**
 * Enterprise UI Design System & Component Stylesheet
 * Standard Look & Feel for Web Tools, Dashboards, and Appliances
 */

@import url('./fonts/inter.css');

/* ==========================================================================
   1. DESIGN TOKENS & CSS VARIABLES
   ========================================================================== */
:root {
    /* Surface & Backgrounds */
    --bg: #f4f7fb;
    --card: #ffffff;
    --surface-subtle: #f8fafc;
    --surface-hover: #f1f5f9;
    
    /* Text & Typography */
    --text: #172033;
    --text-secondary: #475569;
    --muted: #657084;
    --text-inverse: #ffffff;
    
    /* Borders */
    --border: #d8dee9;
    --border-light: #edf2f7;
    --border-focus: #2563eb;
    
    /* Primary Brand (Royal / Electric Blue) */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    --primary-pill: #e8eef8;
    --primary-pill-text: #1e3a8a;
    
    /* Status / Semantic Colors */
    --success: #15803d;
    --success-bg: #dcfce7;
    --success-border: #86efac;
    --success-text: #14532d;
    
    --warning: #b45309;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;
    --warning-text: #92400e;
    
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --danger-text: #991b1b;
    
    --info: #0369a1;
    --info-bg: #e0f2fe;
    --info-border: #7dd3fc;
    --info-text: #075985;
    
    /* Code & Terminal Dark Mode */
    --code-bg: #111827;
    --code-text: #e5e7eb;
    --code-border: #1f2937;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.1);
    --shadow-dropdown: 0 10px 25px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.04);
    --shadow-modal: 0 20px 45px rgba(15, 23, 42, 0.2);
    
    /* Corner Radii */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* ==========================================================================
   2. GLOBAL RESET & BASE STYLES
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

code, pre {
    font-family: Consolas, Monaco, "Courier New", monospace;
}

.container {
    width: min(1200px, calc(100% - 32px));
    margin: 28px auto 80px;
}

/* ==========================================================================
   3. HERO & PAGE HEADER
   ========================================================================== */
header.page-header,
.page-header {
    background: linear-gradient(135deg, #1e3a8a, #2563eb) !important;
    color: #ffffff !important;
    padding: 28px 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

header.page-header h1,
.page-header h1,
.header-content h1 {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 6px;
    letter-spacing: -0.3px;
    color: #ffffff !important;
}

header.page-header p,
.page-header p,
.header-content p,
.doc-prose .page-header p,
.doc-prose header.page-header p {
    margin: 0;
    color: #e2e8f0 !important;
    opacity: 1 !important;
    font-size: 14px;
    line-height: 1.6;
    font-weight: 500;
}

.header-badge {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-blue {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.badge-gold {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-green {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-purple {
    background: #f3e8ff;
    color: #7e22ce;
    border: 1px solid #e9d5ff;
}

/* ==========================================================================
   4. CARDS & SECTION HEADINGS
   ========================================================================== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 26px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.section-title {
    margin: 0 0 4px;
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-description {
    color: var(--muted);
    margin: 0 0 18px;
    font-size: 13px;
}

/* ==========================================================================
   5. GRID LAYOUTS
   ========================================================================== */
.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

/* ==========================================================================
   6. FORM CONTROLS & INPUTS
   ========================================================================== */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field.full {
    grid-column: 1 / -1;
}

label {
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
}

.help {
    color: var(--muted);
    font-size: 12px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid #c8d0dc;
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition-fast);
}

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

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

.inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox, input[type="checkbox"], input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ==========================================================================
   7. BUTTON SYSTEM
   ========================================================================== */
button, .btn {
    border: 0;
    border-radius: 7px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1.2;
    text-decoration: none;
}

button:hover, .btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

button:active, .btn:active {
    transform: translateY(0);
}

button:disabled, .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary, .primary {
    background: var(--primary);
    color: #ffffff !important;
    border: 1px solid var(--primary);
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover, .primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
}

.btn-secondary, .secondary {
    background: #ffffff;
    border: 1px solid #c8d0dc;
    color: var(--text) !important;
}
.btn-secondary:hover, .secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.btn-success, button.success {
    background: var(--success);
    color: #ffffff;
    border: 1px solid var(--success);
}
.btn-success:hover, button.success:hover {
    background: #14532d;
    border-color: #14532d;
}

.btn-warning, button.warning {
    background: #f59e0b;
    color: #111827;
    border: 1px solid #d97706;
}
.btn-warning:hover, button.warning:hover {
    background: #d97706;
    color: #ffffff;
}

.btn-danger, button.danger {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
}
.btn-danger:hover, button.danger:hover {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}

.btn-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
}
.btn-ghost:hover {
    background: #f1f5f9;
    color: var(--text);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 12px 22px;
    font-size: 15px;
    border-radius: var(--radius-md);
}

.icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 7px;
    background: #ffffff;
    border: 1px solid #c8d0dc;
    color: var(--muted);
}
.icon-btn:hover {
    color: var(--text);
    background: #f8fafc;
    border-color: #94a3b8;
}
.icon-btn.active {
    background: var(--primary-pill);
    color: var(--primary-pill-text);
    border-color: #cbd5e1;
}

.view-switcher {
    display: inline-flex;
    align-items: center;
    background: #e8eef8;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
}

.view-switcher .icon-btn {
    border: none;
    background: transparent;
    height: 32px;
    width: 32px;
    border-radius: 6px;
    color: #1e3a8a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.view-switcher .icon-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    stroke: currentColor;
    flex-shrink: 0;
}

.view-switcher .icon-btn:hover {
    background: rgba(255, 255, 255, 0.85);
    color: var(--primary-dark);
}

.view-switcher .icon-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.3);
}

.view-switcher .icon-btn.active svg {
    stroke: #ffffff;
    color: #ffffff;
}

/* Platform / Pill Tab Buttons */
.platform-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.platform-btn {
    background: var(--primary-pill);
    color: var(--primary-pill-text);
    border: 1px solid #cbd5e1;
    padding: 9px 18px;
    border-radius: 7px;
    font-weight: 700;
    font-size: 13px;
}
.platform-btn:hover {
    background: #dbeafe;
}
.platform-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

/* ==========================================================================
   8. CALLOUTS & ALERT BOXES
   ========================================================================== */
.recommendation, .info-box {
    border-left: 4px solid var(--info);
    background: var(--primary-light);
    padding: 13px 16px;
    margin-top: 16px;
    font-size: 13px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text);
}

.warning-box {
    border-left: 4px solid var(--warning);
    background: var(--warning-bg);
    padding: 13px 16px;
    margin-top: 16px;
    font-size: 13px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text);
}

.danger-box {
    border-left: 4px solid var(--danger);
    background: var(--danger-bg);
    padding: 13px 16px;
    margin-top: 16px;
    font-size: 13px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text);
}

.success-box {
    border-left: 4px solid var(--success);
    background: var(--success-bg);
    padding: 13px 16px;
    margin-top: 16px;
    font-size: 13px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text);
}

.status {
    padding: 11px 14px;
    border-radius: 7px;
    margin-top: 14px;
    font-size: 13px;
    font-weight: 700;
}
.status.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}
.status.warning {
    background: #fef3c7;
    color: var(--warning-text);
    border: 1px solid var(--warning-border);
}
.status.error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}
.status.info {
    background: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
}
.status-pill.success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
}
.status-pill.success .status-dot {
    background-color: var(--success);
    box-shadow: 0 0 6px rgba(21, 128, 61, 0.4);
}
.status-pill.warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    color: var(--warning-text);
}
.status-pill.danger {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    box-shadow: 0 0 6px currentColor;
    flex-shrink: 0;
}

/* ==========================================================================
   9. METRICS & SUMMARY ITEMS
   ========================================================================== */
.summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.summary-item {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
}

.summary-item .label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.summary-item .value {
    margin-top: 4px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    word-break: break-word;
}

.progress-track {
    width: 100%;
    height: 7px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #3b82f6);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ==========================================================================
   10. CODE & TERMINAL OUTPUT BLOCKS
   ========================================================================== */
.command-box {
    margin-bottom: 16px;
}

.command-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

pre {
    margin: 0;
    padding: 16px;
    background: var(--code-bg);
    color: var(--code-text);
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid var(--code-border);
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.output-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.code-textarea {
    min-height: 200px;
    width: 100%;
    resize: vertical;
    background: var(--code-bg);
    color: var(--code-text);
    border: 1px solid var(--code-border);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.55;
    outline: none;
}

/* ==========================================================================
   11. DATA TABLE
   ========================================================================== */
.table-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 22px;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--surface-subtle);
    border-bottom: 1px solid var(--border);
    user-select: none;
}

.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text);
}

.data-table tbody tr {
    background: #ffffff;
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background-color: var(--surface-subtle);
}

.data-table tbody tr.selected {
    background-color: var(--primary-light);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ==========================================================================
   12. GRID CARDS (File / Item / Asset Grid)
   ========================================================================== */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 14px;
}

.grid-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    box-shadow: var(--shadow);
}

.grid-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
}

.grid-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.grid-icon-box {
    font-size: 40px;
    margin: 6px 0 12px;
}

.grid-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.grid-sub {
    font-size: 12px;
    color: var(--muted);
}

/* ==========================================================================
   13. BREADCRUMBS & NAVIGATION
   ========================================================================== */
.breadcrumbs-container {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}

.crumb-item {
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    transition: var(--transition-fast);
}

.crumb-item:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.crumb-item.current {
    color: var(--text);
    font-weight: 700;
    cursor: default;
}

.crumb-sep {
    color: #94a3b8;
}

/* ==========================================================================
   14. MODAL DIALOGS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}

.modal-card {
    background: var(--card);
    border: 1px solid var(--border);
    width: min(520px, calc(100% - 32px));
    border-radius: var(--radius);
    box-shadow: var(--shadow-modal);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-card-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--surface-subtle);
}

.modal-card-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.modal-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    background: var(--surface-subtle);
}

/* ==========================================================================
   15. TOAST NOTIFICATIONS
   ========================================================================== */
.toast-stack {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    background: var(--code-bg);
    border: 1px solid #374151;
    box-shadow: var(--shadow-dropdown);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}

/* ==========================================================================
   16. UTILITIES & ANIMATIONS
   ========================================================================== */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   17. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 950px) {
    .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .grid, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .summary { grid-template-columns: 1fr; }
    .button-row button { width: 100%; }
    header.page-header { padding: 20px; }
    .card { padding: 16px; }
}

/* Sidebar Nav Item Protection */
.nav-item-btn {
    white-space: nowrap !important;
}
.nav-item-btn span:first-of-type {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-badge {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

