/* 滑动验证码分布式处理服务 - WebUI 样式 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1c1f2c;
    color: #e4e4e7;
    min-height: 100vh;
}

header {
    background: #1a1d29;
    border-bottom: 1px solid #2d3142;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 22px;
    color: #6db4ff;
}

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

button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s;
}

button:hover { opacity: 0.85; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: #3b82f6; color: white; }
.btn-success { background: #10b981; color: white; }
.btn-secondary { background: #4b5563; color: white; }
.btn-danger { background: #ef4444; color: white; }

main {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #1a1d29;
    border: 1px solid #2d3142;
    border-radius: 8px;
    padding: 16px;
}

.stat-label {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: #e4e4e7;
}

.text-success { color: #10b981; }
.text-warning { color: #f59e0b; }
.text-error { color: #ef4444; }

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #2d3142;
    margin-bottom: 24px;
}

.tab {
    padding: 12px 24px;
    background: transparent;
    color: #9ca3af;
    border-radius: 6px 6px 0 0;
    border: none;
    font-size: 14px;
    cursor: pointer;
}

.tab.active {
    background: #1a1d29;
    color: #6db4ff;
    border-bottom: 2px solid #6db4ff;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

h2 {
    margin-bottom: 16px;
    color: #e4e4e7;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h2 select {
    background: #2d3142;
    color: #e4e4e7;
    border: 1px solid #3f4252;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #1a1d29;
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: #2d3142;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #2d3142;
}

th {
    font-weight: 600;
    font-size: 12px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr:hover {
    background: #2d3142;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending { background: #3f4252; color: #d1d5db; }
.status-assigned { background: #1d4ed8; color: white; }
.status-completed { background: #065f46; color: #d1fae5; }
.status-failed { background: #7f1d1d; color: #fecaca; }
.status-idle { background: #065f46; color: #d1fae5; }
.status-busy { background: #92400e; color: #fed7aa; }
.status-offline { background: #4b5563; color: #d1d5db; }

.btn-detail-link {
    background: #3b82f6;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    border: none;
    cursor: pointer;
}

.btn-delete-link {
    background: #ef4444;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    border: none;
    cursor: pointer;
    margin-left: 4px;
}

.btn-delete-link:hover {
    background: #dc2626;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden { display: none; }

.modal-content {
    background: #1a1d29;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-large { max-width: 1000px; }

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #2d3142;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #6db4ff;
    font-size: 16px;
}

.modal-close {
    background: transparent;
    color: #9ca3af;
    font-size: 24px;
    padding: 0;
    width: 32px;
    height: 32px;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-body label {
    display: block;
    margin-bottom: 16px;
}

.modal-body label > span,
.modal-body label:first-line {
    display: block;
    color: #9ca3af;
    font-size: 13px;
    margin-bottom: 6px;
}

.modal-body input,
.modal-body textarea {
    width: 100%;
    background: #2d3142;
    border: 1px solid #3f4252;
    color: #e4e4e7;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #2d3142;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.detail-grid img {
    width: 100%;
    background: #0d0f17;
    border: 1px solid #2d3142;
    border-radius: 4px;
    min-height: 100px;
}

.logs {
    background: #0d0f17;
    border: 1px solid #2d3142;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.logs .log-entry {
    padding: 2px 0;
    color: #9ca3af;
}

.logs .log-info { color: #6db4ff; }
.logs .log-warn { color: #f59e0b; }
.logs .log-error { color: #ef4444; }
.logs .log-success { color: #10b981; }

#detail-info {
    background: #0d0f17;
    border: 1px solid #2d3142;
    border-radius: 4px;
    padding: 12px;
    color: #d1d5db;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ============ 自定义弹层 ============ */

#custom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#custom-modal.modal-show {
    display: flex !important;
    animation: modalFadeIn 0.2s ease-out;
}

#custom-modal .modal-content {
    background: #1a1d29;
    border-radius: 8px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.25s ease-out;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#custom-modal .modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #2d3142;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
}

#custom-modal .modal-header h3 {
    color: #e4e4e7;
    font-size: 16px;
    font-weight: 600;
    flex: 1;
    margin: 0;
}

#custom-modal .modal-body {
    padding: 24px;
    color: #d1d5db;
    font-size: 14px;
    line-height: 1.6;
}

#custom-modal .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #2d3142;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

#custom-modal .modal-close {
    background: transparent;
    color: #9ca3af;
    font-size: 24px;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

#custom-modal .modal-close:hover {
    background: #2d3142;
    color: #e4e4e7;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header h3 {
    flex: 1;
    color: #e4e4e7;
    font-size: 16px;
}

.modal-icon {
    font-size: 24px;
    margin-right: 12px;
    display: inline-block;
}

.modal-custom.modal-success .modal-icon { color: #10b981; }
.modal-custom.modal-error .modal-icon { color: #ef4444; }
.modal-custom.modal-warning .modal-icon { color: #f59e0b; }
.modal-custom.modal-info .modal-icon { color: #6db4ff; }
.modal-custom.modal-confirm .modal-icon { color: #f59e0b; }

.modal-message {
    color: #d1d5db;
    font-size: 14px;
    line-height: 1.6;
}

.modal-message p {
    margin-bottom: 8px;
}

.modal-message p:last-child {
    margin-bottom: 0;
}

.modal-message code {
    background: #2d3142;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Courier New', monospace;
    color: #6db4ff;
    font-size: 13px;
}

/* 危险按钮（删除） */
.modal-custom.modal-confirm #modal-confirm {
    background: #ef4444;
}

.modal-custom.modal-confirm #modal-confirm:hover {
    background: #dc2626;
}

/* Toast样式（短提示，自动关闭） */
.modal-custom.toast {
    background: rgba(0, 0, 0, 0.85);
    align-items: flex-start;
    padding-top: 80px;
    pointer-events: none;
}

.modal-custom.toast .modal-dialog {
    background: #1a1d29;
    border-left: 4px solid #10b981;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
}

.modal-custom.toast.modal-error .modal-dialog {
    border-left-color: #ef4444;
}

.modal-custom.toast.modal-warning .modal-dialog {
    border-left-color: #f59e0b;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}