/* === CSS Reset === */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, h4, h5, h6, p, ul, ol, li, figure, figcaption, blockquote, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

/* === Sophos UTM Color Scheme === */
:root {
    /* Sidebar */
    --sidebar-bg: #21262b;
    --sidebar-header-bg: #181c20;
    --sidebar-hover: #2c3138;
    --sidebar-active: #333a42;
    --sidebar-active-border: #5b9bd5;
    --sidebar-text: #b0b8c1;
    --sidebar-text-active: #ffffff;
    --sidebar-section-text: #6b7785;
    --sidebar-width: 220px;

    /* Top header bar (UTM blue gradient) */
    --header-bg: linear-gradient(to bottom, #4a7ab5, #3a6499);
    --header-border: #2d5280;
    --header-text: #ffffff;

    /* Content area */
    --content-bg: #dfe3e8;
    --content-panel-bg: #ffffff;

    /* Panel title bar (UTM gray-blue gradient) */
    --panel-header-bg: linear-gradient(to bottom, #7b8fa3, #5e7389);
    --panel-header-text: #ffffff;
    --panel-border: #b0bac4;

    /* Accent colors */
    --primary: #3a7abd;
    --primary-hover: #2d6299;
    --success: #5a9e3e;
    --success-hover: #4a8832;
    --danger: #c0392b;
    --danger-hover: #a52f24;
    --warning: #d4930a;
    --info: #2d80b5;

    /* Text */
    --text: #333333;
    --text-light: #666666;
    --text-muted: #999999;

    /* Borders & misc */
    --border: #c4cbd4;
    --border-light: #dde1e6;
    --table-border: #d0d5da;
    --input-border: #adb5bd;
    --row-alt: #f5f7f9;
    --row-hover: #e8edf2;
}

/* === Body === */
body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, Arial, sans-serif;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text);
    background: var(--content-bg);
}

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

/* === Main Content === */
.main-content {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* === Top Header Bar (UTM blue bar) === */
.content-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    padding: 0 16px;
    height: 36px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.header-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--header-text);
    margin: 0;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.85);
    font-size: 11px;
}

.header-user .btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    padding: 2px 10px;
    font-size: 11px;
    border-radius: 2px;
}

.header-user .btn:hover {
    background: rgba(255,255,255,0.25);
}

/* === Avatar Menu === */
.avatar-menu {
    position: relative;
}

.avatar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.35);
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
}

.avatar-btn:hover {
    background: rgba(255,255,255,0.35);
}

.avatar-initials {
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    text-transform: uppercase;
}

.avatar-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 240px;
    background: #ffffff;
    border: 1px solid #d0d5da;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
}

.avatar-dropdown.open {
    display: block;
}

.avatar-info {
    padding: 12px 14px 10px;
}

.avatar-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.avatar-email {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

.avatar-divider {
    height: 1px;
    background: #e0e4e8;
    margin: 0;
}

.avatar-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 12px;
    color: #333;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
}

.avatar-link:hover {
    background: #f0f2f5;
}

.avatar-link-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.avatar-logout {
    color: #c0392b;
}

.avatar-logout:hover {
    background: #fdf2f2;
}

/* === Content Body === */
.content-body {
    padding: 12px 16px;
    flex: 1;
    background: var(--content-bg);
}

/* === Panel (content box with title bar) === */
.panel {
    background: var(--content-panel-bg);
    border: 1px solid var(--panel-border);
    margin-bottom: 12px;
}

.panel-header {
    background: var(--panel-header-bg);
    color: var(--panel-header-text);
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--panel-border);
}

.panel-body {
    padding: 10px;
}

/* === Firewall Selector (UTM toolbar style) === */
.firewall-selector {
    background: var(--content-panel-bg);
    border: 1px solid var(--panel-border);
    padding: 6px 10px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.firewall-selector label {
    font-weight: 600;
    font-size: 11px;
    color: var(--text);
    white-space: nowrap;
}

.firewall-selector .form-select {
    width: auto;
    min-width: 250px;
    padding: 3px 6px;
    font-size: 11px;
}

/* === Utilities === */
.mt-16 { margin-top: 12px; }
.mb-16 { margin-bottom: 12px; }
.text-muted { color: var(--text-muted); }

/* === Table wrapper === */
.table-wrapper {
    overflow-x: auto;
}

/* === Responsive === */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100% !important; min-height: auto !important; }
    .sidebar-nav { display: flex !important; flex-direction: row !important; overflow-x: auto; padding: 0 !important; }
    .nav-section { display: none; }
    .nav-item { white-space: nowrap; padding: 8px 12px !important; border-left: none !important; }
    .nav-item.active { border-left: none !important; border-bottom: 2px solid var(--sidebar-active-border); }
    .content-body { padding: 8px; }
}

/* === Scrollbar (subtle) === */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #b0b8c2; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #8f99a4; }
