/* B.E.A.C.O.N. Modern Enterprise Styling Sheet */

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

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;

    /* Light Theme Palette */
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --bg-inset: #f1f5f9;
    
    --border-color: #e2e8f0;
    --border-focus: #3b82f6;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;

    --status-online: #10b981;
    --status-warning: #f59e0b;
    --status-critical: #ef4444;
    --status-offline: #64748b;

    --sidebar-width: 240px;
    --header-height: 56px;
    --transition-speed: 0.2s;
}

[data-theme="dark"] {
    /* Dark Theme Palette (Slate Default) */
    --bg-base: #0b0f19;
    --bg-surface: #151b26;
    --bg-surface-hover: #1e2635;
    --bg-inset: #0f131d;

    --border-color: #242f41;
    --border-focus: #3b82f6;

    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-inverse: #0b0f19;

    --primary: #3b82f6;
    --primary-hover: #60a5fa;

    --status-online: #10b981;
    --status-warning: #fbbf24;
    --status-critical: #ef4444;
    --status-offline: #94a3b8;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden; /* Main window is fixed, scroll inside views */
    height: 100vh;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-inset);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Typography Helpers */
h1, h2, h3, h4 {
    font-weight: 600;
    color: var(--text-main);
}
h2 { font-size: 1.25rem; margin-bottom: 1rem; }
h3 { font-size: 1rem; margin-bottom: 0.75rem; }

/* Utilities */
.hidden { display: none !important; }
.flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-mono { font-family: var(--font-mono); }
.text-right { text-align: right; }

/* Badges & Status */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online { background-color: var(--status-online); box-shadow: 0 0 6px var(--status-online); }
.status-dot.warning { background-color: var(--status-warning); box-shadow: 0 0 6px var(--status-warning); }
.status-dot.critical { background-color: var(--status-critical); box-shadow: 0 0 6px var(--status-critical); }
.status-dot.offline { background-color: var(--status-offline); }

.badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}
.badge.critical { background: rgba(239, 68, 68, 0.1); color: var(--status-critical); border-color: rgba(239, 68, 68, 0.2); }
.badge.warning { background: rgba(245, 158, 11, 0.1); color: var(--status-warning); border-color: rgba(245, 158, 11, 0.2); }
.badge.info { background: rgba(59, 130, 246, 0.1); color: var(--primary); border-color: rgba(59, 130, 246, 0.2); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-main);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}
.btn:hover {
    background-color: var(--bg-surface-hover);
}
.btn.btn-primary {
    background-color: var(--primary);
    color: var(--text-inverse);
    border: 1px solid var(--primary);
}
.btn.btn-primary:hover {
    background-color: var(--primary-hover);
}
.btn.btn-danger {
    background-color: var(--status-critical);
    color: #ffffff;
    border: 1px solid var(--status-critical);
}
.btn.btn-danger:hover {
    background-color: #dc2626;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.form-control {
    width: 100%;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-inset);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: border-color var(--transition-speed);
}
.form-control:focus {
    border-color: var(--border-focus);
    outline: none;
}

/* Login Page */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-base);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.5rem;
    letter-spacing: 2px;
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Layout App */
.app-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.logo-section {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 2px;
}

.nav-links {
    list-style: none;
    padding: 1rem 0.5rem;
    flex-grow: 1;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-speed);
    cursor: pointer;
}

.nav-link:hover, .nav-item.active .nav-link {
    color: var(--text-main);
    background-color: var(--bg-inset);
}

.nav-item.active .nav-link {
    color: var(--primary);
    font-weight: 600;
}

.user-section {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.user-info {
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.user-name {
    font-weight: 600;
}

.user-role {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: var(--header-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

.view-container {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Card Grids */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.stat-card-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Tables */
.table-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.table-header-bar {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-search {
    width: 250px;
}

.enterprise-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.enterprise-table th, .enterprise-table td {
    padding: 10px 1rem;
    border-bottom: 1px solid var(--border-color);
}

.enterprise-table th {
    background-color: var(--bg-inset);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.enterprise-table tbody tr:hover {
    background-color: var(--bg-surface-hover);
    cursor: pointer;
}

/* Grid layout for Device Detail view */
.detail-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    height: 100%;
    align-items: start;
}

.detail-sidebar {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.25rem;
}

.detail-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.detail-tab {
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
}

.detail-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.info-list {
    list-style: none;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-muted);
    font-weight: 500;
}

.info-val {
    font-weight: 600;
}

/* Graphs grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1rem;
}

.chart-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
}

.chart-wrapper {
    height: 220px;
    position: relative;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 1.5rem;
}

/* Account Selection Grid & Windows Style Tiles */
.account-tiles-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.account-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.account-tile:hover, .account-tile.selected {
    background: var(--bg-surface-hover);
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.account-tile-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.account-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.account-info-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

.account-info-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.account-tile-remove {
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

.account-tile-remove:hover {
    color: var(--status-critical);
    background: rgba(239, 68, 68, 0.1);
}
