/*!
 * Bootstrap v5.3.0 (https://getbootstrap.com/)
 * Custom styles for 微信活码+抖音卡片管理系统
 */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

footer {
    margin-top: auto;
}

/* 登录页面 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

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

/* 卡片样式 */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.card-header {
    background: white;
    border-bottom: 1px solid #eee;
    font-weight: 600;
}

/* 表格样式 */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    color: #666;
    font-size: 0.875rem;
    border-bottom: 2px solid #dee2e6;
}

.table td {
    vertical-align: middle;
}

/* 缩略图 */
.thumbnail {
    max-width: 60px;
    max-height: 60px;
    object-fit: cover;
    border-radius: 5px;
}

/* 状态标签 */
.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active {
    background: #d1e7dd;
    color: #0f5132;
}

.status-disabled {
    background: #f8d7da;
    color: #842029;
}

.status-pending {
    background: #fff3cd;
    color: #664d03;
}

/* 按钮样式 */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* 表单样式 */
.form-label {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* 警告框 */
.alert {
    border: none;
    border-radius: 8px;
}

/* 导航样式 */
.navbar-brand {
    font-weight: 700;
}

/* 侧边栏样式 */
.list-group-item {
    border: none;
    padding: 0.5rem 1rem;
}

.list-group-item-action:hover {
    background-color: #f8f9fa;
    border-radius: 5px;
}

.list-group-item.active {
    background-color: var(--primary-color);
    border-radius: 5px;
}

/* 分页样式 */
.pagination {
    margin-top: 1rem;
}

.page-link {
    color: var(--primary-color);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 复制按钮 */
.copy-btn {
    cursor: pointer;
}

/* 趣码风格卡片设置弹窗 */
body:has(.card-settings-backdrop) {
    overflow: hidden;
    background: #eef0f3;
}

body:has(.card-settings-backdrop) main {
    padding: 0 !important;
}

body:has(.card-settings-backdrop) footer {
    display: none;
}

.card-settings-background {
    position: fixed;
    z-index: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none;
    background: #fff;
}

.card-settings-backdrop {
    position: fixed;
    z-index: 1040;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: rgba(34, 39, 46, 0.46);
}

.card-settings-dialog {
    width: 804px;
    max-width: calc(100vw - 64px);
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 12px 36px rgba(17, 24, 39, 0.16);
}

.card-settings-header {
    padding: 27px 40px 24px;
    text-align: center;
}

.card-settings-header h5 {
    margin: 0;
    color: #1f2329;
    font-size: 17px;
    font-weight: 500;
}

.card-settings-body {
    padding: 0 50px 28px;
}

.card-link-tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
    margin: 0 0 18px;
    padding: 5px;
    border: 1px solid #dfe3e8;
    border-radius: 4px;
    background: #f7f8fa;
    scrollbar-width: thin;
}

.card-link-tab {
    flex: 1 0 auto;
    min-width: 0;
    padding: 7px 12px;
    border: 0;
    border-right: 1px solid #e5e7eb;
    border-radius: 3px;
    color: #303133;
    background: transparent;
    font-size: 13px;
    line-height: 20px;
    white-space: nowrap;
}

.card-link-tab:last-child {
    border-right: 0;
}

.card-link-tab:hover {
    color: #1664ff;
}

.card-link-tab.active {
    color: #fff;
    background: #337eff;
}

.card-link-panel {
    display: none !important;
}

.card-link-panel.active {
    display: block !important;
}

.card-settings-content {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.card-settings-qr-column {
    text-align: center;
}

.card-link-qr-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 220px;
    height: 230px;
    padding: 5px;
    border: 1px solid #dfe3e8;
    background: #fff;
}

.card-link-qr-wrap::before,
.card-link-qr-wrap::after {
    position: absolute;
    width: 14px;
    height: 14px;
    content: '';
    border-color: #dfe3e8;
}

.card-link-qr-wrap::before {
    top: -10px;
    left: -10px;
    border-top: 2px solid #dfe3e8;
    border-left: 2px solid #dfe3e8;
}

.card-link-qr-wrap::after {
    right: -10px;
    bottom: -10px;
    border-right: 2px solid #dfe3e8;
    border-bottom: 2px solid #dfe3e8;
}

.card-link-qr {
    display: block;
    width: 208px;
    height: 218px;
    object-fit: contain;
}

.card-link-scan-help {
    margin-top: 14px;
    color: #4e5969;
    font-size: 12px;
    white-space: nowrap;
}

.card-link-scan-help strong {
    color: #1664ff;
}

.card-link-no-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 220px;
    height: 230px;
    color: #86909c;
    border: 1px dashed #c9cdd4;
}

.card-link-no-qr i {
    margin-bottom: 8px;
    font-size: 38px;
}

.card-settings-detail-column {
    min-width: 0;
    padding-top: 0;
}

.card-link-tip {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 28px;
    padding: 0 2px;
    color: #4e5969;
    font-size: 13px;
}

.card-link-tip i {
    color: #337eff;
}

.card-link-value {
    overflow: hidden;
    margin: 0 0 9px;
    padding: 11px 16px;
    color: #1664ff;
    border-radius: 8px;
    background: #f2f3f5;
    font-size: 15px;
    line-height: 22px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-bind-row {
    display: flex;
    align-items: center;
    min-height: 66px;
    margin-bottom: 9px;
    padding: 10px 13px;
    border-radius: 8px;
    background: #f7f8fa;
}

.card-bind-icon {
    display: flex;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin-right: 13px;
    color: #1664ff;
    border-radius: 50%;
    background: #e8efff;
    font-size: 22px;
}

.card-bind-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

.card-bind-copy strong {
    color: #1d2129;
    font-size: 13px;
}

.card-bind-copy span {
    margin-top: 2px;
    color: #86909c;
    font-size: 12px;
}

.card-bind-button,
.card-bind-button:hover,
.card-bind-button:focus {
    min-width: 88px;
    padding: 9px 16px;
    color: #fff;
    border: 0;
    border-radius: 4px;
    background: #165dff;
    font-size: 13px;
}

.card-settings-actions {
    display: flex;
    gap: 12px;
}

.card-settings-actions .btn {
    min-width: 96px;
    padding: 10px 16px;
    border: 0;
    border-radius: 4px;
    font-size: 13px;
}

.card-action-primary,
.card-action-primary:hover,
.card-action-primary:focus {
    color: #fff;
    background: #165dff;
}

.card-action-secondary,
.card-action-secondary:hover,
.card-action-secondary:focus {
    color: #4e5969;
    background: #f2f3f5;
}

.card-action-secondary:disabled {
    color: #86909c;
    opacity: 1;
}

.card-account-management {
    margin-top: 18px;
    border-top: 1px solid #f0f1f2;
}

.card-account-management summary {
    padding: 12px 0 0;
    color: #86909c;
    cursor: pointer;
    font-size: 12px;
}

.card-account-management-body {
    padding-top: 16px;
}

.copy-toast {
    position: fixed;
    z-index: 1080;
    right: 1.25rem;
    bottom: 1.25rem;
    padding: 0.7rem 1rem;
    color: #fff;
    border-radius: 0.5rem;
    background: #198754;
    box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.18);
    opacity: 0;
    pointer-events: none;
    transform: translateY(0.75rem);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.copy-toast.error {
    background: #dc3545;
}

.copy-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .login-card {
        margin: 1rem;
        padding: 1.5rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .thumbnail {
        max-width: 40px;
        max-height: 40px;
    }

    .card-settings-backdrop {
        align-items: flex-start;
        padding: 12px;
    }

    .card-settings-dialog {
        max-width: 100%;
        max-height: calc(100vh - 24px);
    }

    .card-settings-header {
        padding: 20px 20px 16px;
    }

    .card-settings-body {
        padding: 0 16px 20px;
    }

    .card-link-tab {
        flex: 0 0 auto;
    }

    .card-settings-content {
        grid-template-columns: 1fr;
    }

    .card-settings-qr-column {
        margin-bottom: 4px;
    }

    .card-settings-actions {
        flex-wrap: wrap;
    }

    .card-settings-actions .btn {
        flex: 1 1 calc(50% - 6px);
    }
}

/* 二次确认弹窗 */
.confirm-modal .modal-header {
    background: #f8f9fa;
}

.confirm-modal .btn-danger {
    background-color: var(--danger-color);
}
