/* 全局样式 */
:root {
    --primary-color: #4e73df;
    --secondary-color: #6c757d;
    --success-color: #1cc88a;
    --danger-color: #e74a3b;
    --warning-color: #f6c23e;
    --info-color: #36b9cc;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 80px;
    --header-height: 60px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fc;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 响应式容器 */
.container-fluid {
    display: flex;
    flex: 1;
    width: 100%;
    padding: 0;
    position: relative;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    padding: 20px;
    transition: margin-left 0.3s;
    width: 100%;
}

/* 卡片样式 */
.card {
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    padding: 0.75rem 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

/* 按钮样式 */
.btn-primary {
    background-color: #4e73df;
    border-color: #4e73df;
}

.btn-primary:hover {
    background-color: #2e59d9;
    border-color: #2653d4;
}

.btn-success {
    background-color: #1cc88a;
    border-color: #1cc88a;
}

.btn-success:hover {
    background-color: #17a673;
    border-color: #169b6b;
}

.btn-danger {
    background-color: #e74a3b;
    border-color: #e74a3b;
}

.btn-danger:hover {
    background-color: #d52a1a;
    border-color: #c9271a;
}

/* 文本颜色 */
.text-primary {
    color: #4e73df !important;
}

.text-success {
    color: #1cc88a !important;
}

.text-danger {
    color: #e74a3b !important;
}

.text-warning {
    color: #f6c23e !important;
}

.text-info {
    color: #36b9cc !important;
}

/* 背景颜色 */
.bg-light {
    background-color: #f8f9fc !important;
}

.bg-primary {
    background-color: #4e73df !important;
}

.bg-success {
    background-color: #1cc88a !important;
}

/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    background-color: #4e73df;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    padding-top: var(--header-height);
    transition: all 0.3s;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.sidebar .list-group {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
    padding: 0;
}

.sidebar .list-item {
    color: rgba(255, 255, 255, 0.8);
    padding: 1rem 1.5rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

.sidebar .list-item:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: #fff;
}

.sidebar .list-item.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
    border-left-color: #fff;
    font-weight: bold;
}

.sidebar .menu-icon {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.sidebar .menu-text {
    flex: 1;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #4668c5;
    color: white;
}

.sidebar-header h5 {
    margin: 0;
}

.close-sidebar {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

/* 移动端菜单按钮 */
.mobile-menu-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1050;
}

.navbar-toggler {
    background-color: #4e73df;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 4px;
}

.navbar-toggler i {
    font-size: 1.5rem;
}

/* 侧边栏遮罩层 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* 表格样式 */
.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    background-color: transparent;
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid #e3e6f0;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #e3e6f0;
    background-color: #f8f9fc;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.05);
}

.table-bordered {
    border: 1px solid #e3e6f0;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #e3e6f0;
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 徽章样式 */
.badge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    font-size: 14px;
    padding: 5px 10px;
}

.badge-primary {
    color: #fff;
    background-color: #4e73df;
}

.badge-success {
    color: #fff;
    background-color: #1cc88a;
}

.badge-danger {
    color: #fff;
    background-color: #e74a3b;
}

.badge-warning {
    color: #212529;
    background-color: #f6c23e;
}

.badge-info {
    color: #fff;
    background-color: #36b9cc;
}

.badge-secondary {
    color: #fff;
    background-color: #858796;
}

/* 加载遮罩层 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
    font-size: 24px;
}

/* 文本截断 */
.truncate-text {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 网站列表特定样式 */
.expired {
    background-color: #ffdddd;
}

.expiring-soon {
    background-color: #ffffcc;
}

.border-right {
    border-right: 1px solid #dee2e6;
}

/* 悬停阴影效果 */
.hover-shadow:hover {
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
    transform: translateY(-3px);
    transition: all .3s ease;
}

/* 用户中心页面样式 */
.user-info .mb-3 {
    margin-bottom: 1rem !important;
}

.user-info .p-3 {
    padding: 1rem !important;
}

.user-info .border-start {
    border-left-width: 3px !important;
    border-left-style: solid !important;
}

.user-info .border-primary {
    border-color: #4e73df !important;
}

.user-info .border-success {
    border-color: #1cc88a !important;
}

.user-info .border-info {
    border-color: #36b9cc !important;
}

.user-info .border-warning {
    border-color: #f6c23e !important;
}

.user-info .rounded {
    border-radius: 0.25rem !important;
}

.user-info .mb-2 {
    margin-bottom: 0.5rem !important;
}

.user-info .mb-0 {
    margin-bottom: 0 !important;
}

.user-info i {
    margin-right: 15px;
}

.user-info .text-dark {
    margin-left: 10px;
}

/* 退出按钮样式 */
.logout-container {
    padding: 0 15px;
    width: 100%;
}

.logout-button {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(to right, #e74a3b, #c0392b);
    color: white !important;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.logout-button:hover {
    background: linear-gradient(to right, #c0392b, #e74a3b);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.logout-button i {
    margin-right: 10px;
    font-size: 1.2em;
}

.logout-button span {
    font-weight: 500;
}

/* 适配深色模式 */
@media (prefers-color-scheme: dark) {
    .logout-button {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    }
}

/* 响应式调整 */
@media (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: 80%;
        max-width: 300px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 15px;
        padding-top: 60px;
    }
    
    body.sidebar-open {
        overflow: hidden;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table th, .table td {
        padding: 0.5rem;
    }
    
    .btn-group-sm > .btn, .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .h5 {
        font-size: 1.1rem;
    }
    
    .container-fluid {
        padding: 0;
    }
    
    .row {
        margin-right: -10px;
        margin-left: -10px;
    }
    
    .col, .col-1, .col-10, .col-11, .col-12, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-auto, .col-lg, .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-auto, .col-md, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-auto, .col-sm, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-auto, .col-xl, .col-xl-1, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-auto {
        padding-right: 10px;
        padding-left: 10px;
    }
}

@media (min-width: 768px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }
    
    .mobile-menu-toggle {
        display: none;
    }
}

/* 打印样式 */
@media print {
    .sidebar, .mobile-menu-toggle, .sidebar-overlay {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .no-print {
        display: none !important;
    }
}

/* API列表页面特定样式 */
.api-header {
    background-color: #f8f9fc;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 0;
    border-left: 4px solid #4e73df;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
}

.api-header h1 {
    margin: 0;
    color: #5a5c69;
    font-size: 1.8rem;
    font-weight: 500;
}

.search-form {
    width: 100%;
}

.btn-search {
    background-color: #4e73df;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    min-width: 100px;
}

.btn-search:hover {
    background-color: #2e59d9;
}

.btn-add {
    background-color: #1cc88a;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s;
}

.btn-add:hover {
    background-color: #17a673;
    color: white;
}

.api-table {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.api-table .table {
    margin-bottom: 0;
}

.api-table th {
    background-color: #f8f9fc;
    color: #5a5c69;
    font-weight: 600;
    border-bottom: 2px solid #e3e6f0;
    padding: 12px 15px;
}

.api-table td {
    padding: 12px 15px;
    vertical-align: middle;
}

.api-table .btn {
    padding: 5px 10px;
}

.api-key-cell {
    position: relative;
    max-width: 150px;
}

.api-key-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.api-key-toggle {
    cursor: pointer;
    color: #4e73df;
    margin-left: 5px;
}

.description-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-result {
    padding: 40px 0;
    text-align: center;
    color: #858796;
}

.empty-result i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #dddfeb;
}

/* 辅助间距类 */
.gap-1 {
    gap: 0.25rem !important;
}

.gap-2 {
    gap: 0.5rem !important;
}

.gap-4 {
    gap: 1.5rem !important;
}

/* API列表响应式调整 */
@media (max-width: 767.98px) {
    .api-header {
        padding: 15px;
    }
    
    .api-header h1 {
        font-size: 1.5rem;
    }
    
    .btn-search, .btn-add {
        padding: 8px 15px;
    }
    
    .api-table td, .api-table th {
        padding: 10px;
    }
}
