/* Dark theme variables */
:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e6e6e6;
    --text-secondary: #b3b3b3;
    --text-muted: #888888;
    --border-color: #404040;
    --accent-primary: #3671b4;
    --accent-secondary: #6c757d;
    --success-bg: #1a3d2e;
    --success-border: #2d5a45;
    --error-bg: #3d1a1a;
    --error-border: #5a2d2d;
    --error-text: #ff6b6b;
    --warning-bg: #3d2a1a;
    --warning-border: #5a432d;
    --warning-text: #ffb74d;
}

/* Base styles */
body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif; 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 20px; 
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Form and filter styles */
.filters, .controls { 
    background: var(--bg-secondary); 
    padding: 20px; 
    border-radius: 8px; 
    margin-bottom: 20px; 
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 16px;
    align-items: start; /* Align inputs to bottom for consistent height */
}

/* Input styles */
input[type="text"], input[type="number"], input[type="datetime-local"] {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

input[type="text"]:focus, input[type="number"]:focus, input[type="datetime-local"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

input::placeholder {
    color: var(--text-muted);
}

/* Card styles */
.request-card { 
    background: var(--bg-secondary);
    border: 1px solid var(--border-color); 
    margin: 12px 0; 
    padding: 18px; 
    border-radius: 8px; 
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.request-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.request-card.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary);
}

.success { 
    background-color: var(--success-bg); 
    border-color: var(--success-border);
}

.warning {
    background-color: var(--warning-bg);
    border-color: var(--warning-border);
}

.error {
    background-color: var(--error-bg);
    border-color: var(--error-border);
}

/* HTTP Method badges */
.method { 
    font-weight: 600; 
    padding: 4px 8px; 
    border-radius: 4px; 
    color: white; 
    font-size: 12px;
    text-transform: uppercase;
}

/* Replay indicator badges */
.replay-badge {
    display: inline-block;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 8px;
    background-color: #6f47cc;
    color: white;
    border: 1px solid #642fc0;
}

.replayed-badge {
    display: inline-block;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 8px;
    background-color: #0891b2;
    color: white;
    border: 1px solid #0e7490;
    cursor: help;
    letter-spacing: 0.5px;
}

.GET { background-color: #3c8d3f; }
.POST { background-color: #d88200; }
.PUT { background-color: #1874be; }
.DELETE { background-color: #a72c23; }
.PATCH { background-color: #89279b; }

/* Button styles */
button { 
    padding: 10px 16px; 
    margin: 6px; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background-color: #3d8bfd;
}

.btn-secondary {
    background-color: var(--accent-secondary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

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

.btn-danger:hover {
    background-color: #bb2d3b;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 20, 20, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: rgba(51, 51, 51, 1);
    padding: 20px;
    border-radius: 5px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    position: relative;
}

.modal-large .modal-content {
    max-width: 95%;
    width: 900px;
}

.btn-close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

.modal-message {
    text-align: center; 
    font-size: 16px;
}

.replay-modal {
    text-align: left;
    max-width: 100%;
}

.replay-modal h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.body-selection {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.body-selection h4 {
    margin-top: 0;
}

.body-option {
    display: block;
    padding: 12px;
    margin: 8px 0;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.body-option:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.body-option input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
}

.body-option input[type="radio"]:checked + strong,
.body-option:has(input[type="radio"]:checked) {
    border-color: var(--accent-primary);
    background: var(--bg-primary);
}

.body-editor {
    margin: 20px 0;
}

.edit-body-checkbox {
    display: block;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edit-body-checkbox:hover {
    border-color: var(--accent-primary);
}

.edit-body-checkbox input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

.edit-body-checkbox:has(input[type="checkbox"]:checked) {
    border-color: var(--accent-primary);
    background: var(--bg-primary);
}

.body-editor textarea {
    width: calc(100% - 20px);
    min-height: 250px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.4;
    resize: vertical;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.body-editor textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-secondary);
}

.body-editor textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.editor-info {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

.header-editor {
    margin: 20px 0;
}

.header-override-rows {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.header-override-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 6px;
}

.header-override-row:has(.header-override-checkbox:checked) {
    border-color: var(--accent-primary);
    background: var(--bg-primary);
}

.header-override-checkbox-label {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: 220px;
    cursor: pointer;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
}

.header-override-checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

.header-override-value {
    flex: 1 1 auto;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
}

.header-override-value:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-secondary);
}

.header-override-value:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.header-override-add {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.header-override-add input[type="text"] {
    flex: 1 1 auto;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
}

.modal-message p {
    text-align: center; 
}

.modal-message-detail {
    color: var(--text-muted);
    font-size: 14px;
}

.modal-message-buttons {
    display: flex; gap: 10px; justify-content: center;
}

/* Code and pre styles */
pre { 
    background: var(--bg-tertiary); 
    color: var(--text-primary);
    padding: 16px; 
    border-radius: 6px; 
    overflow-x: auto; 
    border: 1px solid var(--border-color);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* Utility classes */
.hidden { 
    display: none !important; 
}

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

/* Header styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

header h1 {
    color: var(--text-primary);
    margin: 0;
    font-size: 28px;
    font-weight: 700;
}

header h1 .logo {
    height: 32px;
    top: 6px;
    position: relative;
}


.auth-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Auth required section */
.auth-required {
    text-align: center;
    padding: 3rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin: 2rem 0;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.auth-required h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 24px;
}

.auth-required p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 16px;
}

/* User info */
#userInfo {
    font-weight: 500;
    color: var(--text-primary);
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

/* Error styling */
.error {
    background-color: var(--error-bg);
    color: var(--error-text);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--error-border);
    margin: 1rem 0;
}

/* Statistics section */
.statistics {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.statistics h3 {
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 20px;
}

/* Results section */
.results {
    margin-top: 20px;
}

/* Search section */
.search-section h2 {
    color: var(--text-primary);
    margin-bottom: 16px;
    font-size: 20px;
}

/* DateTime group styling */
.datetime-formgroup{
    grid-column: span 2;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 16px;
    align-items: end; /* Align inputs to bottom for consistent height */
}

.datetime-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.datetime-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0;
}

/* DateTime input styling - Enhanced for dark theme */
input[type="datetime-local"] {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    
    /* Force dark theme appearance */
    color-scheme: dark;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

input[type="datetime-local"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

/* Date presets */
.date-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    grid-column: 1 / -1; /* Span full width */
    margin: 8px 0;
}

.btn-preset {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-preset:hover {
    background: var(--accent-secondary);
    color: white;
    transform: translateY(-1px);
}

.btn-preset[data-clear="true"] {
    background: transparent;
    color: var(--text-muted);
}

.btn-preset[data-clear="true"]:hover {
    background: var(--error-bg);
    border-color: var(--error-border);
    color: var(--error-text);
}

/* Status code group styling */
.status-code-formgroup{
    grid-column: span 2;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 16px;
    align-items: end; /* Align inputs to bottom for consistent height */
}

.status-code-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-code-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0;
    letter-spacing: 0.5px;
}

.status-code-group input[type="number"] {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.status-code-group input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

/* Status code presets */
.status-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    grid-column: 1 / -1; /* Span full width */
    margin: 6px 0;
}

.btn-status-preset {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-status-preset:hover {
    background: var(--accent-secondary);
    color: white;
    transform: translateY(-1px);
}

.btn-status-preset[data-min="200"] {
    border-color: #4CAF50;
    color: #4CAF50;
}

.btn-status-preset[data-min="200"]:hover {
    background: #4CAF50;
    color: white;
}

.btn-status-preset[data-min="400"] {
    border-color: #FF9800;
    color: #FF9800;
}

.btn-status-preset[data-min="400"]:hover {
    background: #FF9800;
    color: white;
}

.btn-status-preset[data-min="500"] {
    border-color: #f44336;
    color: #f44336;
}

.btn-status-preset[data-min="500"]:hover {
    background: #f44336;
    color: white;
}

.btn-status-preset[data-clear-status="true"] {
    background: transparent;
    color: var(--text-muted);
}

.btn-status-preset[data-clear-status="true"]:hover {
    background: var(--error-bg);
    border-color: var(--error-border);
    color: var(--error-text);
}

.others-formgroup{
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 16px;
    align-items: end; /* Align inputs to bottom for consistent height */
}

/* Action buttons group */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    grid-column: 1 / -1; /* Span full width */
    margin-top: 12px;
}

/* Dropdown styling to match existing inputs */
.dropdown-input {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    cursor: pointer;
    width: 100%;
    min-height: 40px; /* Match other inputs */
}

.dropdown-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.dropdown-input option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 8px 12px;
}

/* Dark theme arrow for select */
.dropdown-input {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .search-form {
        grid-template-columns: 1fr;
    }
    
    .auth-section {
        flex-direction: column;
    }
    
    .request-card {
        padding: 12px;
    }
    
    button {
        width: 100%;
        margin: 4px 0;
    }
    
    .date-presets {
        justify-content: center;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons button {
        width: 100%;
        margin: 2px 0;
    }
    
    .status-presets {
        justify-content: center;
        gap: 4px;
    }
    
    .btn-status-preset {
        font-size: 10px;
        padding: 4px 8px;
    }
}

/* Scrollbar styling for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8a9198;
}

/* Selection styling */
::selection {
    background-color: rgba(74, 158, 255, 0.3);
    color: var(--text-primary);
}

/* Focus styles for accessibility */
button:focus-visible, input:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Dark theme for webkit calendar picker */
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    background-color: var(--text-secondary);
    border-radius: 3px;
    cursor: pointer;
    filter: invert(1);
}

input[type="datetime-local"]::-webkit-datetime-edit {
    color: var(--text-primary);
}

input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper {
    background: transparent;
}

input[type="datetime-local"]::-webkit-datetime-edit-text {
    color: var(--text-secondary);
}