:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --background: #ffffff;
    --surface: #f8f9fa;
    --text: #333333;
    --text-muted: #6c757d;
    --border: #dee2e6;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --background: #121212;
    --surface: #1e1e1e;
    --text: #e0e0e0;
    --text-muted: #a0a0a0;
    --border: #333333;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
}

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

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.request-panel, .response-panel {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.request-line {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: stretch;
}

.method-select {
    min-width: 100px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.url-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
    color: var(--text);
    font-size: 14px;
}

.send-btn {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.send-btn:hover {
    background: var(--primary-hover);
}

.send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
    border-bottom: 2px solid transparent;
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-panel {
    display: none;
}

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

.headers-list {
    margin-bottom: 16px;
}

.header-row {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    align-items: center;
}

.header-key, .header-value {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--background);
    color: var(--text);
    font-size: 13px;
}

.remove-btn {
    width: 28px;
    height: 28px;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.body-textarea {
    width: 100%;
    height: 200px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
    color: var(--text);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    resize: vertical;
    line-height: 1.5;
}

.body-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.format-btn {
    background: var(--text-muted);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

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

.response-header h3 {
    font-size: 1.4rem;
    color: var(--text);
}

.response-info {
    display: flex;
    gap: 16px;
    font-size: 12px;
}

.status {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.status.success {
    background: var(--success-color);
    color: white;
}

.status.error {
    background: var(--error-color);
    color: white;
}

.status.warning {
    background: var(--warning-color);
    color: black;
}

.time, .size {
    color: var(--text-muted);
    font-weight: 500;
}

.response-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.response-content {
    min-height: 300px;
}

.response-body, .response-headers, .response-cookies, .response-raw {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 200px;
}

/* Body controls */
.body-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.body-type-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--background);
    color: var(--text);
    font-size: 13px;
}

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

/* Auth styles */
.auth-type-section {
    margin-bottom: 20px;
}

.auth-type-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

.auth-type-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--background);
    color: var(--text);
    font-size: 14px;
}

.auth-config {
    display: none;
    padding: 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 16px;
}

.auth-config.active {
    display: block;
}

.auth-config label {
    display: block;
    margin-bottom: 8px;
    margin-top: 12px;
    font-weight: 500;
    color: var(--text);
    font-size: 14px;
}

.auth-config label:first-child {
    margin-top: 0;
}

.auth-config input, .auth-config select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
}

.auth-config p {
    color: var(--text-muted);
    font-style: italic;
    margin: 0;
}

/* Options styles */
.option-group {
    margin-bottom: 16px;
}

.option-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
}

.checkbox-label {
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
}

.option-group input[type="number"] {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--background);
    color: var(--text);
    font-size: 14px;
    margin-left: 8px;
}

/* Test styles */
.tests-list {
    margin-bottom: 16px;
}

.test-item {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.test-name {
    flex: 1;
    min-width: 150px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--background);
    color: var(--text);
    font-size: 13px;
}

.test-condition {
    flex: 1;
    min-width: 150px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--background);
    color: var(--text);
    font-size: 13px;
}

.test-value {
    flex: 1;
    min-width: 100px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--background);
    color: var(--text);
    font-size: 13px;
}

.test-results {
    margin-top: 16px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.test-results h4 {
    margin-bottom: 12px;
    color: var(--text);
}

.test-result {
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 14px;
}

.test-result.passed {
    background: rgba(40, 167, 69, 0.1);
    border-left: 4px solid var(--success-color);
    color: var(--success-color);
}

.test-result.failed {
    background: rgba(220, 53, 69, 0.1);
    border-left: 4px solid var(--error-color);
    color: var(--error-color);
}

/* Action buttons */
.request-actions, .response-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 8px 16px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--border);
}

.response-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: var(--border);
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

/* History styles */
.history-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.history-item:hover {
    background: var(--background);
}

.history-method {
    font-weight: 600;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--primary-color);
    color: white;
    min-width: 60px;
    text-align: center;
    height: fit-content;
}

.history-url {
    flex: 1;
    font-family: monospace;
    font-size: 13px;
    color: var(--text);
    word-break: break-all;
}

.history-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.json-key {
    color: #0451a5;
}

.json-string {
    color: #098658;
}

.json-number {
    color: #098658;
}

.json-boolean {
    color: #0000ff;
}

.json-null {
    color: #8b949e;
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .request-line {
        flex-direction: column;
    }
    
    .method-select {
        min-width: auto;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 15px;
    }
    
    .request-panel, .response-panel {
        padding: 16px;
    }
    
    .test-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .test-name, .test-condition, .test-value {
        min-width: auto;
        margin-bottom: 8px;
    }
    
    .body-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .response-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .request-actions, .response-actions {
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab {
        flex: 1;
        min-width: 80px;
        text-align: center;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .history-item {
        flex-direction: column;
        gap: 8px;
    }
    
    .history-method {
        width: fit-content;
    }
}