/* DashingPower Management System Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    color: #333;
    font-size: 14px;
    line-height: 1.45;
}

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

/* Sidebar */
.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 16px;
    background: #243342;
    text-align: center;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-header p {
    font-size: 12px;
    color: #95a5a6;
    margin-top: 4px;
}

.nav-menu {
    list-style: none;
    padding: 0;
}

.nav-item {
    border-bottom: 1px solid #34495e;
}

.nav-link {
    display: block;
    padding: 12px 16px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    font-size: 14px;
}

.nav-link:hover {
    background: #34495e;
    color: #fff;
}

.nav-link.active {
    background: #3498db;
    color: #fff;
}

.nav-link i {
    margin-right: 8px;
    width: 20px;
    display: inline-block;
    text-align: center;
}

.submenu {
    list-style: none;
    background: #243342;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out;
}

.submenu.show {
    max-height: 1000px; /* 足够大的值以容纳子菜单内容 */
    transition: max-height 0.3s ease-in;
}

.submenu .nav-link {
    padding: 10px 16px 10px 40px;
    font-size: 13px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
}

/* Top Navigation */
.top-nav {
    background: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.breadcrumb {
    font-size: 14px;
    color: #666;
}

.breadcrumb a {
    color: #3498db;
    text-decoration: none;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-menu span {
    color: #666;
    font-size: 14px;
}

.btn-logout {
    padding: 7px 14px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
}

.btn-logout:hover {
    background: #c0392b;
}

/* Content Area */
.content {
    flex: 1;
    padding: 20px;
}

/* Cards */
.card {
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 16px;
}

.card-header {
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.card-header h3 {
    font-size: 17px;
    color: #333;
}

.card-body {
    padding: 16px;
}

/* Buttons */
.btn {
    padding: 8px 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    line-height: 1.2;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #219a52;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #d68910;
}

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

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    vertical-align: middle;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

/* ID列（第一列）宽度优化 */
.table th:first-child,
.table td:first-child {
    width: 65px;
    min-width: 65px;
    max-width: 65px;
    text-align: center;
}

/* 操作列（最后一列）紧凑展示 */
.table th:last-child,
.table td:last-child {
    width: 1%;
    white-space: nowrap;
}

.table td:last-child .btn {
    margin: 0 2px;
    padding: 4px 8px;
    font-size: 11px;
    white-space: nowrap;
}

.table td:last-child form {
    display: inline !important;
    margin: 0 2px;
}

.table tr:hover {
    background: #f8f9fa;
}

/* 固定列表格容器 */
.table-container {
    width: 100%;
    overflow-x: auto;
    position: relative;
}

/* 固定列表格 */
.table-fixed {
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-fixed th,
.table-fixed td {
    white-space: nowrap;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    vertical-align: middle;
}

.table-fixed th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 固定第一列（ID列）*/
.table-fixed th:first-child,
.table-fixed td:first-child {
    position: sticky;
    left: 0;
    z-index: 11;
    background: #f8f9fa;
    border-right: 2px solid #ddd;
    width: 65px;
    min-width: 65px;
    max-width: 65px;
    text-align: center;
}

.table-fixed tbody td:first-child {
    background: #fff;
}

.table-fixed tr:hover td:first-child {
    background: #f8f9fa;
}

/* 固定最后一列（操作列）*/
.table-fixed th:last-child,
.table-fixed td:last-child {
    position: sticky;
    right: 0;
    z-index: 11;
    background: #f8f9fa;
    border-left: 2px solid #ddd;
    width: 1%;
    white-space: nowrap;
}

.table-fixed tbody td:last-child {
    background: #fff;
}

.table-fixed tr:hover td:last-child {
    background: #f8f9fa;
}

/* 操作列按钮组 - 紧凑展示 */
.table-fixed td:last-child .btn {
    margin: 0 2px;
    padding: 4px 8px;
    font-size: 11px;
    white-space: nowrap;
}

.table-fixed td:last-child form {
    display: inline !important;
    margin: 0 2px;
}

/* Forms */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #333;
    font-weight: 500;
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
    min-height: 34px;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.form-check-input {
    width: 16px;
    height: 16px;
}

/* Alerts */
.alert {
    padding: 12px 14px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
}

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

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Badges */
.badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

/* Tree Menu */
.tree-menu {
    list-style: none;
}

.tree-item {
    margin: 4px 0;
}

.tree-content {
    display: flex;
    align-items: center;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 13px;
}

.tree-children {
    margin-left: 24px;
    margin-top: 4px;
}

.tree-toggle {
    cursor: pointer;
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

.menu-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

/* Login Page Specific */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: white;
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-header h1 {
    color: #333;
    font-size: 25px;
    margin-bottom: 8px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    .main-content {
        margin-left: 200px;
    }
}

@media (max-width: 576px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .main-content {
        margin-left: 0;
    }
}
