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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Tab 样式 */
.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 30px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

.card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-family: 'Courier New', monospace;
    transition: border-color 0.3s;
    resize: vertical;
    min-height: 120px;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input[type="text"] {
    font-family: 'Courier New', monospace;
}

.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9em;
}

/* 表单行布局 */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.button {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 10px;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.button.secondary {
    background: #6c757d;
}

.button-small {
    padding: 6px 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s;
}

.button-small:hover {
    background: #5568d3;
}

.result {
    margin-top: 25px;
    display: none;
}

.result.show {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.packet-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.packet-header {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 5px;
}

.packet-body {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    padding: 15px;
    border-radius: 5px;
}

/* 签名结果区域 */
.signature-section {
    background: #f0f7ff;
    border-left: 4px solid #2196f3;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.signature-value {
    background: #e8f5e9;
    padding: 8px 12px;
    border-radius: 5px;
    font-weight: bold;
    color: #2e7d32;
    word-break: break-all;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: bold;
    color: #667eea;
    min-width: 180px;
}

.info-value {
    font-family: 'Courier New', monospace;
    color: #333;
    word-break: break-all;
    flex: 1;
    text-align: right;
}

.hex-display {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    overflow-x: auto;
    line-height: 1.8;
}

.error {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    display: none;
}

.error.show {
    display: block;
    animation: fadeIn 0.3s;
}

.cmd-name {
    display: inline-block;
    padding: 4px 12px;
    background: #667eea;
    color: white;
    border-radius: 4px;
    font-size: 0.9em;
    margin-left: 10px;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
    margin-left: 8px;
}

.badge.encrypted {
    background: #f44336;
    color: white;
}

.badge.plain {
    background: #4caf50;
    color: white;
}

.badge.valid {
    background: #4caf50;
    color: white;
}

.badge.invalid {
    background: #f44336;
    color: white;
}

.loading {
    display: none;
    text-align: center;
    margin-top: 15px;
    color: #667eea;
}

.loading.show {
    display: block;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.info-box {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.info-box h3 {
    color: #2e7d32;
    margin-bottom: 10px;
}

.info-box ul {
    margin-left: 20px;
    color: #555;
    line-height: 1.8;
}

.hint-text {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 20px;
}

.warning-box {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    padding: 15px;
    margin-top: 15px;
    border-radius: 5px;
}

.warning-box h4 {
    color: #e65100;
    margin-bottom: 8px;
}

.example-list {
    display: grid;
    gap: 15px;
}

.example-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.example-item h4 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1em;
}

.example-item code {
    display: block;
    background: white;
    padding: 10px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    word-break: break-all;
    margin-bottom: 10px;
    color: #333;
}

.footer {
    text-align: center;
    color: white;
    margin-top: 30px;
    opacity: 0.8;
}

.footer a {
    color: white;
    text-decoration: underline;
}

.parsed-content {
    background: #f0f7ff;
    border-left: 4px solid #2196f3;
    padding: 15px;
    margin-top: 15px;
    border-radius: 5px;
}

.parsed-content h4 {
    color: #1976d2;
    margin-bottom: 10px;
}

.field-item {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
}

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

.field-label {
    font-weight: bold;
    color: #555;
}

.field-value {
    font-family: 'Courier New', monospace;
    color: #333;
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }

    .card {
        padding: 20px;
    }

    .tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
    }

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

    .info-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .info-value {
        text-align: left;
        margin-top: 5px;
    }

    .field-item {
        flex-direction: column;
    }
    
    .field-value {
        margin-top: 5px;
    }
}
