/* Base Reset & Variables */
:root {
    --bg-color: #17171a;
    --bg-card: #27272a;
    --bg-input: #1b1b1e;

    --text-main: #e4e4e7;
    --text-muted: #a1a1aa;
    --text-dark: #52525b;

    --border-color: #3f3f46;
    --border-focus: #7c3aed;
    /* Purple focus */

    --primary: #5c4ad5;
    /* Purple */
    --primary-hover: #7b6ae0;
    --success: #608d4b;
    /* Green */
    --success-hover: #6ea356;
    --warning: #df8a21;
    /* Orange */
    --warning-hover: #eaa03f;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    --transition: all 0.2s ease-in-out;

    --sidebar-w: 30%;
    --content-w: 60%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Noto Sans SC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

/* Layout */
.app-container {
    width: 100%;
    max-width: 1200px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Header */
.page-header {
    background-color: var(--bg-card);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.header-content h1 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.header-content .subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.icon-button {
    background: white;
    color: #333;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.icon-button:hover {
    transform: scale(1.05);
    background: #f4f4f5;
}

/* Card */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 16px 24px 8px;
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

/* Tabs */
.tabs {
    display: flex;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    gap: 2px;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    color: #fff;
}

.tab-btn.active {
    color: #fff;
    border-bottom-color: var(--primary);
    font-weight: 500;
}

.tab-pane {
    display: none;
    padding: 24px 0;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form Groups */
.form-group {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
    padding: 4px 24px;
    transition: background-color 0.2s;
}

.form-group:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.form-group>label {
    width: var(--sidebar-w);
    text-align: right;
    padding-right: 24px;
    padding-top: 8px;
    color: var(--text-main);
    font-weight: 400;
}

.form-group>label.disabled {
    color: var(--text-dark);
}

.form-group>label.invisible {
    visibility: hidden;
}

.form-control-wrapper {
    width: var(--content-w);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-control-static {
    padding-top: 8px;
    font-size: 13px;
}

.text-muted {
    color: var(--text-muted);
}

.help-text {
    font-size: 12px;
    color: var(--text-dark);
    margin-top: 6px;
}

/* Inputs & Controls */
.form-control {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 14px;
    width: 100%;
    max-width: 400px;
    /* Constrain input width */
    transition: var(--transition);
    font-family: inherit;
    outline: none;
}

.form-control:focus {
    border-color: var(--border-focus);
}

.form-control::placeholder {
    color: var(--text-dark);
}

/* Select custom arrow */
select.custom-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23a1a1aa%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 10px auto;
    cursor: pointer;
}

select.custom-select:focus {
    border-color: var(--border-focus);
}

/* Input with icon */
.input-with-icon {
    position: relative;
    max-width: 400px;
}

.input-with-icon input {
    max-width: 100%;
    padding-right: 36px;
}

.btn-icon-primary {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    background-color: var(--primary);
    border: none;
    color: white;
    width: 34px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon-primary:hover {
    background-color: var(--primary-hover);
}

/* Checkbox */
.checkbox-group .form-control-wrapper {
    flex-direction: column;
    justify-content: center;
    padding-top: 8px;
}

input[type="checkbox"].custom-checkbox {
    appearance: none;
    background-color: var(--bg-input);
    margin: 0;
    font: inherit;
    color: var(--text-main);
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    display: grid;
    place-content: center;
    cursor: pointer;
    transition: var(--transition);
}

input[type="checkbox"].custom-checkbox::before {
    content: "";
    width: 10px;
    height: 10px;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
    transform: scale(0);
    background-color: white;
    transition: 120ms transform ease-in-out;
}

input[type="checkbox"].custom-checkbox:checked {
    background-color: var(--text-main);
    border-color: var(--text-main);
}

input[type="checkbox"].custom-checkbox:checked::before {
    transform: scale(1);
}

input[type="checkbox"].custom-checkbox:disabled {
    background-color: var(--bg-input);
    border-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    font-weight: 500;
    color: white;
}

.btn.lg {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-primary {
    background-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-success {
    background-color: var(--success);
}

.btn-success:hover {
    background-color: var(--success-hover);
}

.btn-warning {
    background-color: var(--warning);
}

.btn-warning:hover {
    background-color: var(--warning-hover);
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 0 4px;
}

/* Terminal Log */
.log-control {
    align-items: flex-start;
}

.log-terminal {
    background-color: #000;
    border-radius: var(--radius-sm);
    padding: 12px;
    min-height: 450px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    color: #4ade80;
    /* bright green for logs */
    overflow-y: auto;
    border: 1px solid var(--border-color);
    width: 100%;
}

.log-terminal pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Footer */
.page-footer {
    text-align: right;
    font-size: 12px;
    color: var(--text-dark);
    padding-right: 8px;
}

/* Responsive constraints if necessary */
@media (max-width: 768px) {
    .form-group {
        flex-direction: column;
        padding: 12px 24px;
    }

    .form-group>label {
        width: 100%;
        text-align: left;
        padding-right: 0;
        padding-bottom: 8px;
        padding-top: 0;
    }

    .form-control-wrapper {
        width: 100%;
    }

    .form-control-static {
        padding-top: 0;
    }

    .checkbox-group .form-control-wrapper {
        padding-top: 0;
    }

    .form-group>label.invisible {
        display: none;
    }
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    font-size: 13px;
}

.data-table th {
    padding: 16px 12px;
    font-weight: 500;
    color: #fff;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 16px 12px;
    border-bottom: 1px solid rgba(63, 63, 70, 0.4);
    color: var(--text-main);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

.table-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.table-footer {
    padding: 12px 24px;
    background-color: rgba(0, 0, 0, 0.1);
    /* Slightly darker inner section for footer */
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-start;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    padding: 6px 8px;
    display: inline-flex;
    align-items: center;
}

/* Modal Overlay & Animations */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* 相比完全居中，弹窗位置偏上更符合截图 */
    padding-top: 10vh;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Content Box */
.modal-content {
    background-color: #1e1e20;
    /* 弹窗底色稍微深一点 */
    width: 90%;
    max-width: 800px;
    border-radius: var(--radius-sm);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateY(-20px) scale(0.98);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    /* 更微弱的边界 */
}

.modal-header h3 {
    font-size: 14px;
    color: #d19a3b;
    /* 截图里金黄色/橙黄色的主题文字 */
    font-weight: 500;
}

.modal-body {
    padding: 24px 0;
    max-height: 65vh;
    overflow-y: auto;
}

/* 覆盖特定情况下的 label 样式使其符合纵向横排 */
.form-horizontal .form-group {
    padding: 8px 32px;
}

.form-horizontal .form-group>label {
    width: 25%;
}

.form-horizontal .form-control-wrapper {
    width: 75%;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: rgba(0, 0, 0, 0.1);
    /* 底部稍微加深一点 */
}

/* Secondary Button for Modal Close */
.btn-secondary {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.25);
}