/* assets/css/admin.css */
:root {
    --primary-color: #333;
    --secondary-color: #f4f4f4;
    --text-color: #333;
    --sidebar-width: 250px;
    --header-height: 60px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-color);
    background-color: #fafafa;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: #0066cc;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-color);
    color: #fff;
    flex-shrink: 0;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 1.2rem;
    font-weight: bold;
    border-bottom: 1px solid #444;
}

.sidebar-nav {
    list-style: none;
    padding: 20px 0;
}

.sidebar-nav li a {
    display: block;
    padding: 10px 20px;
    color: #ddd;
    transition: background-color 0.2s;
}

.sidebar-nav li a:hover {
    background-color: #444;
    color: #fff;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* for responsive */
}

/* Topbar */
.topbar {
    height: var(--header-height);
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 20px;
}

/* Content Area */
.content {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

/* Utilities */
.btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.btn:hover {
    background-color: #555;
}

.btn-danger {
    background-color: #cc0000;
}

.btn-danger:hover {
    background-color: #ee0000;
}

.form-group {
    margin-bottom: 15px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

/* Login specific */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: #f0f2f5;
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 20px;
}

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: #fff;
}

.table th,
.table td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: left;
}

.table th {
    background-color: #f9f9f9;
}

/* Toggle Switch */
input[type="checkbox"][role="switch"] {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 24px;
    position: relative;
    cursor: pointer;
    outline: none;
    vertical-align: middle;
    transition: background 0.3s;
}

input[type="checkbox"][role="switch"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="checkbox"][role="switch"]:checked {
    background: #4caf50;
}

input[type="checkbox"][role="switch"]:checked::after {
    transform: translateX(20px);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

.text-bg-danger {
    color: #fff !important;
    background-color: #dc3545 !important;
}


.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

/* Sidebar Accordion */
.sidebar-accordion {
    margin: 5px 10px;
}

.sidebar-accordion summary {
    padding: 10px 15px;
    cursor: pointer;
    list-style: none;
    /* hide default arrow */
    display: flex;
    justify-content: flex-start;
    align-items: center;
    color: #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: background-color 0.2s, border 0.2s;
    border: 1px solid transparent;
}

.sidebar-accordion summary::-webkit-details-marker {
    display: none;
}

.sidebar-accordion summary::after {
    content: '＞';
    font-size: 0.8em;
    margin-left: auto;
    transition: transform 0.2s;
}

.sidebar-accordion[open] summary {
    border: 1px solid #fff;
    color: #fff;
}

.sidebar-accordion[open] summary::after {
    content: '∨';
}

.sidebar-accordion summary:hover {
    background-color: #444;
}

.sidebar-accordion ul {
    list-style: none;
    padding-left: 0;
    margin-top: 5px;
    margin-bottom: 10px;
}

.sidebar-accordion ul li a {
    display: flex;
    align-items: center;
    padding: 8px 15px 8px 30px;
    color: #bbb;
    transition: color 0.2s;
}

.sidebar-accordion ul li a:hover {
    color: #fff;
    background-color: transparent;
}

.sidebar-accordion .icon {
    width: 24px;
    text-align: center;
    margin-right: 8px;
    display: inline-block;
}

/* organization */
.org-layout {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.org-panel {
    flex: 1;
    min-width: 300px;
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.org-panel-tree {
    max-height: calc(100vh - 240px);
    overflow-y: auto;
}

.org-panel-form {
    position: sticky;
    top: 20px;
}

.org-panel-title {
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.org-tree-list {
    list-style: none;
    padding: 0;
}

.org-input-readonly {
    background-color: #eee;
}

.org-form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.org-action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.org-btn-clear {
    background-color: #6c757d;
    color: #fff;
}

.org-btn-outline {
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ccc;
}

.org-btn-primary {
    background-color: #0d6efd;
    color: #fff;
}

.org-result {
    margin-top: 15px;
}

/* org tree nodes */
.org-tree-ul {
    list-style: none;
    margin: 0;
}

.org-tree-ul-root {
    padding-left: 0;
}

.org-tree-ul-child {
    padding-left: 20px;
}

.org-tree-li {
    margin: 6px 0;
    position: relative;
}

.org-tree-node {
    display: flex;
    align-items: center;
    padding: 0px 10px;
    border-radius: 4px;
}

.org-tree-node-root {
    background-color: #f0f4f8;
    border-left: 4px solid #0d6efd;
}

.org-tree-node-child {
    background-color: transparent;
    border-left: none;
}

.org-tree-connector {
    color: #999;
    font-family: monospace;
    font-size: 14px;
}

.org-tree-label {
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
    width: 100%;
}

.org-tree-label:hover {
    background-color: #e9ecef;
}

.org-tree-label-root {
    font-weight: bold;
}

.org-tree-label-child {
    font-weight: normal;
}

.org-tree-icon {
    margin-right: 8px;
    font-size: 16px;
}