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

body {
    font-family: 'Arial', sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
}

.container {
    display: flex;
    min-height: 100vh;
    gap: 10px;
    padding: 10px;
    align-items: flex-start;
}

/* 左侧菜单栏 */
.sidebar {
    width: 250px;
    background: #2d2d2d;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    border: 1px solid #404040;
}

.sidebar h2 {
    margin-bottom: 15px;
    color: #ffffff;
    font-size: 16px;
    border-bottom: 1px solid #404040;
    padding-bottom: 8px;
}

.level-list {
    flex: 0 0 auto;
    overflow: visible;
    margin-bottom: 10px;
    max-height: none;
}

.level-item {
    padding: 8px 12px;
    margin-bottom: 5px;
    background: #3a3a3a;
    border: 1px solid #505050;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-item:hover {
    background: #4a4a4a;
    border-color: #4a9eff;
}

.level-item.active {
    background: #4a9eff;
    color: white;
    border-color: #4a9eff;
}

.level-content {
    flex: 1;
    cursor: pointer;
}

.delete-level-btn {
    padding: 4px 8px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.3s ease;
    margin-left: 8px;
    opacity: 0.7;
    min-width: 45px;
    white-space: nowrap;
}

.delete-level-btn:hover {
    background: #c82333;
    opacity: 1;
}

.level-item:hover .delete-level-btn {
    opacity: 1;
}

.add-level-btn {
    padding: 8px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.add-level-btn:hover {
    background: #218838;
}

/* 右侧主内容 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 空状态样式 */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
    background: #2d2d2d;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border: 1px solid #404040;
}

.empty-state-icon {
    font-size: 48px;
    color: #6c757d;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #ffffff;
    font-size: 24px;
    margin-bottom: 10px;
    font-weight: 500;
}

.empty-state p {
    color: #b0b0b0;
    font-size: 16px;
    margin-bottom: 30px;
    line-height: 1.5;
    max-width: 400px;
}

.add-first-level-btn {
    padding: 12px 24px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.add-first-level-btn:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.add-first-level-btn i {
    margin-right: 8px;
}

.level-info-section, .cats-section, .save-section {
    background: #2d2d2d;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border: 1px solid #404040;
}

.cats-section {
    min-height: auto;
    height: auto;
    max-height: none;
    overflow: visible;
}

.level-info-section h3, .cats-section h3 {
    margin-bottom: 15px;
    color: #ffffff;
    font-size: 16px;
    border-bottom: 1px solid #404040;
    padding-bottom: 8px;
}

/* 表单样式 */
.level-info-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    min-width: 120px;
    position: relative;
}

.form-group .validation-message {
    font-size: 12px;
    color: #dc3545;
    margin-top: 2px;
    display: none;
}

.form-group .validation-message.show {
    display: block;
}

.form-group input:invalid {
    border-color: #dc3545;
}

.form-group input:valid {
    border-color: #28a745;
}

.form-group.full-width {
    flex: 1;
    min-width: 200px;
}

.form-group label {
    font-size: 12px;
    margin-bottom: 4px;
    color: #b0b0b0;
    font-weight: bold;
}

.form-group input {
    padding: 6px 8px;
    border: 1px solid #505050;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
    background-color: #3a3a3a;
    color: #e0e0e0;
}

.form-group input:focus {
    outline: none;
    border-color: #4a9eff;
}

.form-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    gap: 10px;
}

.export-btn {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.export-btn:hover {
    background: #218838;
}

.copy-btn {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #0056b3;
}

.import-btn {
    padding: 8px 16px;
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.import-btn:hover {
    background: #f57c00;
}

/* 猫咪信息部分 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.add-cat-btn {
    padding: 6px 12px;
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.add-cat-btn:hover {
    background: #138496;
}

.cats-list {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 12px;
    align-items: flex-start;
    height: auto;
    max-height: none;
    overflow: visible;
}

.cat-item {
    background: #3a3a3a;
    border: 1px solid #505050;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    min-width: 360px;
    flex: 1 1 360px;
}

.cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cat-title {
    font-weight: bold;
    color: #ffffff;
    font-size: 14px;
}

.delete-btn {
    padding: 4px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    min-width: 60px;
    white-space: nowrap;
}

.delete-btn:hover {
    background: #c82333;
}

.cat-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.cat-form-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cat-form-group {
    display: flex;
    flex-direction: column;
    min-width: 100px;
    position: relative;
}

.cat-form-group .validation-message {
    font-size: 12px;
    color: #dc3545;
    margin-top: 2px;
    display: none;
}

.cat-form-group .validation-message.show {
    display: block;
}

.cat-form-group input:invalid {
    border-color: #dc3545;
}

.cat-form-group input:valid {
    border-color: #28a745;
}

.cat-form-group.full-width {
    flex: 1;
    min-width: 200px;
}

.cat-form-group label {
    font-size: 11px;
    margin-bottom: 2px;
    color: #b0b0b0;
}

.cat-form-group input {
    padding: 4px 6px;
    border: 1px solid #505050;
    border-radius: 3px;
    font-size: 12px;
    background-color: #3a3a3a;
    color: #e0e0e0;
}

.cat-form-group input.readonly-input,
.cat-form-group input[readonly] {
    background-color: #2a2a2a;
    color: #909090;
    cursor: not-allowed;
}

.cat-form-group input.readonly-input:hover,
.cat-form-group input[readonly]:hover {
    background-color: #252525;
    border-color: #606060;
}

.form-group input[readonly],
.form-group input:disabled {
    background-color: #2a2a2a;
    color: #909090;
    cursor: not-allowed;
    border-color: #404040;
}

.form-group input[readonly]:hover,
.form-group input:disabled:hover {
    background-color: #252525;
    border-color: #606060;
}

/* 不可编辑输入的更明显指示：锁图标与额外右侧留白 */
.cat-form-group input[readonly],
.form-group input[readonly],
.form-group input:disabled {
    padding-right: 28px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23909090' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='10' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px 14px;
}

/* 悬浮时边框更醒目 */
.cat-form-group input[readonly]:hover,
.form-group input[readonly]:hover,
.form-group input:disabled:hover {
    border-color: #7a7a7a;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #2d2d2d;
    margin: 10vh auto;
    padding: 20px;
    border-radius: 8px;
    width: 300px;
    max-height: 90vh;
    overflow: auto;
    text-align: center;
    border: 1px solid #404040;
    color: #e0e0e0;
}

.modal-content h4 {
    color: #ffffff;
    margin-bottom: 10px;
}

.modal-content p {
    color: #b0b0b0;
    margin-bottom: 15px;
}

.import-modal-content {
    width: 680px;
    max-width: 90%;
    text-align: left;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #404040;
}

.modal-header h4 {
    margin: 0;
    color: #ffffff;
    font-size: 18px;
}

.close-modal-btn {
    background: none;
    border: none;
    color: #909090;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.close-modal-btn:hover {
    color: #ffffff;
}

.modal-body {
    margin-bottom: 15px;
}

.import-instruction {
    color: #b0b0b0;
    margin-bottom: 10px;
    font-size: 14px;
}

.import-textarea {
    width: 100%;
    height: 300px;
    background-color: #121212;
    color: #e0e0e0;
    border: 1px solid #505050;
    border-radius: 4px;
    padding: 12px 14px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    box-sizing: border-box;
}

.import-textarea:focus {
    outline: none;
    border-color: #4a9eff;
}

.import-textarea::placeholder {
    color: #777;
}

.import-confirm-btn {
    background: #4CAF50;
}

.import-confirm-btn:hover {
    background: #45a049;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 15px;
}

.confirm-btn {
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.cancel-btn {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.confirm-btn:hover {
    background: #c82333;
}

.cancel-btn:hover {
    background: #545b62;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #505050;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #606060;
}