/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 
                 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

/* ========== 容器 ========== */
.container {
    max-width: 820px;
    margin: 0 auto;
}

/* ========== 头部 ========== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    padding: 28px 32px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.35);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 32px;
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.subtitle {
    margin-top: 6px;
    font-size: 14px;
    opacity: 0.85;
}

.status-badge {
    display: inline-block;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
}

.status-badge.online {
    background: rgba(52, 211, 153, 0.3);
    color: #6ee7b7;
}

.status-badge.offline {
    background: rgba(248, 113, 113, 0.3);
    color: #fca5a5;
}

.status-badge.checking {
    background: rgba(251, 191, 36, 0.3);
    color: #fcd34d;
}

/* ========== 卡片 ========== */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

.card-header h2 {
    font-size: 17px;
    font-weight: 600;
    color: #1a1a2e;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin-top: 4px;
}

.card-body {
    padding: 24px;
}

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

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #f9fafb;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    background: white;
}

.form-group input::placeholder {
    color: #9ca3af;
}

.hint {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 48px;
}

.btn-eye {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.btn-eye:hover {
    opacity: 1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.divider {
    border: none;
    border-top: 1.5px dashed #e5e7eb;
    margin: 20px 0;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* ========== 按钮 ========== */
button {
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

button:active {
    transform: scale(0.97);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd6;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-icon {
    background: none;
    padding: 4px 8px;
    font-size: 18px;
    color: #6b7280;
    border-radius: 6px;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: #1f2937;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ========== 状态消息 ========== */
.status-message {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
}

.status-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.status-message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.status-message.hidden {
    display: none;
}

/* ========== 今日状态 ========== */
.today-status {
    margin-top: 16px;
    padding: 16px 20px;
    border-radius: 10px;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    min-height: 60px;
}

.status-placeholder {
    color: #9ca3af;
    text-align: center;
    font-size: 14px;
}

.today-status.success {
    background: #f0fdf4;
    border-color: #86efac;
}

.today-status.success .status-icon {
    color: #10b981;
}

.today-status.failed {
    background: #fef2f2;
    border-color: #fca5a5;
}

.today-status.failed .status-icon {
    color: #ef4444;
}

.today-status .status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.today-status .status-icon {
    font-size: 28px;
}

.today-status .status-info {
    flex: 1;
}

.today-status .status-info .main {
    font-size: 16px;
    font-weight: 600;
}

.today-status .status-info .detail {
    font-size: 13px;
    color: #6b7280;
    margin-top: 2px;
}

.today-status .status-rank {
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
}

.control-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ========== 历史记录 ========== */
.history-list {
    max-height: 360px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    color: #9ca3af;
    padding: 32px 0;
    font-size: 14px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
}

.history-item:hover {
    background: #fafafa;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item .date {
    font-weight: 500;
    color: #1f2937;
    font-size: 14px;
}

.history-item .result {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.history-item .result.success {
    color: #10b981;
}

.history-item .result.failed {
    color: #ef4444;
}

.history-item .rank-badge {
    background: #f3f4f6;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: #6b7280;
}

.history-item .time {
    font-size: 12px;
    color: #9ca3af;
}

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    width: 100%;
}

.toast {
    padding: 14px 20px;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

.toast.info {
    background: #667eea;
}

.toast.warning {
    background: #f59e0b;
}

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

/* ========== 底部 ========== */
.footer {
    text-align: center;
    padding: 24px 0 12px;
    font-size: 13px;
    color: #9ca3af;
}

.footer p {
    margin-bottom: 4px;
}

.footer a {
    color: #667eea;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    body {
        padding: 12px;
    }

    .header {
        padding: 20px 18px;
    }

    .header h1 {
        font-size: 20px;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .card-body {
        padding: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
        justify-content: center;
    }

    .control-row {
        flex-direction: column;
    }

    .control-row button {
        width: 100%;
        justify-content: center;
    }

    .history-item {
        flex-wrap: wrap;
        gap: 4px;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        max-width: none;
    }
}

/* ========== 滚动条美化 ========== */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
