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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

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

header {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.server-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.9rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--warning-color);
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: var(--success-color);
    animation: none;
}

.status-indicator.error {
    background: var(--error-color);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tool-card {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tool-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.tool-card.selected {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.tool-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.tool-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.tool-card .params {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.tool-card .param-tag {
    display: inline-block;
    background: var(--bg-color);
    padding: 4px 8px;
    border-radius: 4px;
    margin: 4px 4px 4px 0;
    font-size: 0.8rem;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.tool-caller {
    max-width: 600px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.select-input,
.text-input,
.textarea-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.select-input:focus,
.text-input:focus,
.textarea-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.textarea-input {
    min-height: 120px;
    font-family: 'Courier New', monospace;
    resize: vertical;
}

.param-group {
    margin-bottom: 15px;
}

.param-group label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.required-badge {
    background: var(--error-color);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.results {
    min-height: 200px;
    max-height: 600px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.result-item {
    background: var(--bg-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

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

.result-title {
    font-weight: 600;
    color: var(--text-primary);
}

.result-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.result-content {
    background: white;
    border-radius: 6px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
}

.result-error {
    border-left-color: var(--error-color);
    background: #fef2f2;
}

.result-success {
    border-left-color: var(--success-color);
}

.json-content {
    background: #1e293b;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
}

footer {
    text-align: center;
    padding: 20px;
    color: white;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 10px;
    }
}

.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

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