/* ============================================================
   OCRP Trust Panel — Dark Theme
   ============================================================ */

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

:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-input: #252833;
    --bg-hover: #2a2e3d;
    --border: #2e3245;
    --text: #e0e0e0;
    --text-muted: #888;
    --accent: #6c5ce7;
    --accent-hover: #5a4bd1;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --public: #27ae60;
    --restricted: #e67e22;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Header */
#header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    flex-wrap: wrap;
    gap: 10px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.dot.offline { background: var(--danger); }

#status-text { font-size: 13px; color: var(--text-muted); }

/* Inputs */
input, select {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 13px;
    outline: none;
    transition: border 0.15s;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-muted); }

/* Buttons */
.btn {
    padding: 7px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }

.btn-edit { background: var(--accent); color: #fff; }
.btn-edit:hover { background: var(--accent-hover); }

.btn-sm { padding: 4px 10px; font-size: 12px; }

.btn-block { width: 100%; }

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}
.btn-close:hover { color: var(--text); }

/* Toast */
#toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    color: #fff;
    animation: slideIn 0.25s ease;
    min-width: 220px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--accent); }
.fade-out { animation: fadeOut 0.3s ease forwards; }

@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(40px); } }

/* Main layout */
#main {
    display: flex;
    min-height: calc(100vh - 58px);
}

/* Sidebar */
#sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

#sidebar h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 0 20px 10px;
}

#category-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
}

#category-list li {
    padding: 8px 20px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.1s;
}
#category-list li:hover { background: var(--bg-hover); }
#category-list li.active { background: var(--accent); color: #fff; }
#category-list li.active .badge { background: rgba(255,255,255,0.25); }

.badge {
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Content */
#content {
    flex: 1;
    padding: 24px;
    overflow-x: auto;
}

#dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#dashboard-header h2 { font-size: 20px; font-weight: 600; }

.search-bar input { width: 260px; }

/* Table */
#asset-table-wrap { overflow-x: auto; }

#asset-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
}

#asset-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    background: var(--bg-input);
    border-bottom: 1px solid var(--border);
}

#asset-table tbody td {
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

#asset-table tbody tr:hover { background: var(--bg-hover); }

.actions { display: flex; gap: 6px; }

.tag {
    background: var(--bg-input);
    color: var(--accent);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

code.mini { font-size: 11px; }

.access-badge {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.access-badge.public { background: rgba(39,174,96,0.15); color: var(--public); }
.access-badge.restricted { background: rgba(230,126,34,0.15); color: var(--restricted); }

.muted { color: var(--text-muted); }

.empty { text-align: center; color: var(--text-muted); padding: 40px 0; font-size: 14px; }

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 480px;
    max-width: 94vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.modal-sm { width: 380px; }

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

.modal-header h3 { font-size: 16px; }

form {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

form label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

form input, form select { width: 100%; }

.input-group {
    display: flex;
    gap: 8px;
}
.input-group select { flex: 0 0 140px; }
.input-group input { flex: 1; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
}

#delete-msg {
    padding: 20px;
    font-size: 14px;
    color: var(--text);
}

/* Responsive */
@media (max-width: 768px) {
    #main { flex-direction: column; }
    #sidebar { width: 100%; min-width: 0; flex-direction: row; flex-wrap: wrap; padding: 10px; }
    #sidebar h3 { display: none; }
    #category-list { display: flex; flex-wrap: wrap; gap: 4px; }
    #category-list li { padding: 6px 12px; border-radius: 6px; }
    .sidebar-actions { width: 100%; }
    .header-right input { width: 120px; }
    .header-actions { flex-direction: column; align-items: flex-start !important; }
}

/* Sidebar parent/child */
#category-list li.parent { font-weight: 600; }
#category-list li.child {
    padding-left: 36px;
    font-size: 13px;
    color: var(--text-muted);
}
#category-list li.child:hover { color: var(--text); }
#category-list li.child.active { color: #fff; }

.caret {
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.6;
}

/* Sidebar actions */
.sidebar-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sidebar-actions .btn { width: 100%; font-size: 12px; }

/* Header actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Tags in table */
.tag-group {
    background: rgba(108,92,231,0.2);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.tag-sub {
    background: var(--bg-input);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

/* Group edit info */
.group-info {
    padding: 0 20px;
    font-size: 13px;
    color: var(--text-muted);
}
.group-info strong { color: var(--text); }
