/* Prevent horizontal stretching of response box */
.response-body {
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}
.response-view {
    max-width: 100%;
    overflow-x: auto;
}
.response-view pre {
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 100%;
    box-sizing: border-box;
}
/* --- Response Toolbar and Badges --- */
.response-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}


/* Basic editor appearance - flexible height */
.CodeMirror {
  height: calc(100vh - 400px); /* Dynamic height based on viewport minus header/controls */
  min-height: 300px; /* Minimum height for usability */
  max-height: 80vh; /* Maximum height to prevent overflow */
  border: 1px solid #e0e0e0;
  font-size: 14px;
  flex: 1; /* Allow it to grow within its container */
}

/* Target ONLY JSON keys (properties that are also strings) */
.cm-s-default .cm-property.cm-string {
  color: #A31515; /* Dark Red */
}

/* Target string VALUES, but EXCLUDE anything that is also a key */
.cm-s-default .cm-string:not(.cm-property) {
  color: #0451A5; /* Blue */
}

/* Target numbers, booleans (true/false), and null */
.cm-s-default .cm-number,
.cm-s-default .cm-atom {
  color: #8959A8; /* Purple */
}

/* === CodeMirror Final Theme End === */


.toolbar-actions {
    display: flex;
    gap: 8px;
}

.toolbar-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 14px;
    padding: 6px;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.toolbar-btn:hover {
    background-color: #e5e7eb;
    color: #1f2937;
}

.toolbar-search {
    position: relative;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute;
    left: 10px;
    color: #9ca3af;
    font-size: 12px;
}

.response-search {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 10px 6px 30px; /* Add padding for the icon */
    font-size: 13px;
    width: 200px;
}

.response-view pre[class*="language-"] {
    background: #2d2d2d; /* A dark background like Postman */
    color: #ccc;
    text-shadow: none;
}

.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
    color: #9a86fd; /* Key color */
}

.token.string {
    color: #a5e24d; /* String value color */
}

.token.number {
    color: #ffaa55; /* Number value color */
}

.token.boolean {
    color: #ff7ab2; /* Boolean value color */
}

.token.function {
    color: #ffd700;
}

.token.punctuation {
    color: #ccc;
}
pre mark.current-match {
    background-color: #f97316; /* A bright orange */
    color: white;
}


.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    margin-right: 6px;
    background: #e0e7ff;
    color: #3730a3;
    vertical-align: middle;
}
.badge.req-time {
    background: #d1fae5;
    color: #047857;
}
.badge.res-size {
    background: #fee2e2;
    color: #b91c1c;
}

.response-toolbar .response-action-btn {
    margin-left: 0;
}

/* Animated search bar */
.response-toolbar .response-search {
    width: 0;
    opacity: 0;
    transition: width 0.3s, opacity 0.3s;
    margin-left: 0;
    display: inline-block;
    vertical-align: middle;
}
.response-toolbar .response-search[style*="display: inline-block"] {
    width: 180px;
    opacity: 1;
    margin-left: 8px;
}
/* --- Custom styles for status-indicator and response controls --- */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0 8px 0;
    min-height: 36px;
}

.status-code {
    font-weight: 600;
    font-size: 15px;
    color: #2563eb;
    margin-right: 8px;
}


.status-code.success {
    background-color: #dcfce7; /* Green for success (2xx) */
    color: #166534;
}

.status-code.error {
    background-color: #fee2e2; /* Red for errors (4xx, 5xx) */
    color: #991b1b;
}

#requestStatsDisplay {
    display: inline-flex;
    gap: 8px;
    margin-left: 15px;
    vertical-align: middle;
}

.stat-badge {
    background-color: #e5e7eb;
    color: #4b5563;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

#requestStatsDisplay {
    margin-left: 15px;
    font-size: 12px;
    color: #6b7280;
}

.response-action-btn {
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    margin-left: 8px;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease;
}

.response-action-btn i {
    font-size: 16px;
}

.response-action-btn:hover {
    background-color: #e5e7eb;
}

.response-search {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    margin-left: 8px;
}
.main-content {

    display: inline-block;

}


.api-test-container {

    max-width: 100%;

    margin: 0 auto;

    padding: 20px;

    background-color: #f8f9fa;

    min-height: 100vh;

    width: 100%;

    box-sizing: border-box;

}


/* API Tabs - Now at the top */

.api-tabs {

    display: flex;

    gap: 0;

    margin-bottom: 24px;

    border-bottom: 1px solid #e5e7eb;

    background: white;

    padding: 0 24px;

    border-radius: 12px 12px 0 0;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

}


.tab-btn {

    background: none;

    border: none;

    padding: 12px 20px;

    color: #6b7280;

    cursor: pointer;

    border-bottom: 3px solid transparent;

    font-weight: 500;

    transition: all 0.2s ease;

}


.tab-btn.active {

    color: #10b981;

    border-bottom-color: #10b981;

}


.tab-btn:hover {

    color: #10b981;

}

/* Special highlighting for Test API tab - matching Raise a Ticket button style */
.tab-btn[data-tab="test"] {
    position: relative;
    background: #3B82F6;
    color: white !important;
    border-radius: 8px 8px 0 0;
    margin: 0 4px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    padding: 12px 20px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.tab-btn[data-tab="test"]:hover {
    background: #2563eb;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
}

.tab-btn[data-tab="test"]::before {
    content: "🧪";
    margin-right: 8px;
    font-size: 1.1em;
}

.tab-btn[data-tab="test"].active {
    background: #2563eb;
    color: white !important;
    border-bottom-color: #3B82F6;
}


/* API Content */

.api-content {
    display: flex;
    gap: 20px;
    align-items: stretch; /* Changed from flex-start to stretch for equal heights */
    min-height: 600px;
}

/* Special highlighting for Test API content area - matching green theme */
#testApiContent {
    position: relative;
    border: 2px solid #22C55E;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.05) 0%, rgba(22, 163, 74, 0.05) 100%);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.1);
}

/* Progress indicator for long-running requests */
.progress-indicator {
    display: none;
    margin: 10px 0;
    padding: 12px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(22, 163, 74, 0.1) 100%);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 8px;
    font-size: 14px;
    color: #16a34a;
}

.progress-indicator.show {
    display: block;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: rgba(34, 197, 94, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #22C55E 0%, #16a34a 100%);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
    animation: progress-pulse 2s ease-in-out infinite;
}

@keyframes progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Large response indicator */
.stat-badge.large-response {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
    animation: large-response-pulse 2s ease-in-out infinite;
}

/* Complex response indicator */
.stat-badge.complex-response {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
    animation: complex-response-pulse 2s ease-in-out infinite;
}

@keyframes large-response-pulse {
    0%, 100% { 
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
        transform: scale(1.02);
    }
}

@keyframes complex-response-pulse {
    0%, 100% { 
        box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
        transform: scale(1.02);
    }
}

/* Pagination Controls for Large Responses */
.response-pagination {
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pagination-info span {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.pagination-info span:first-child {
    color: #6B7280;
    font-size: 12px;
}

.pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination-btn {
    padding: 6px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pagination-btn:hover:not(:disabled) {
    background: #F9FAFB;
    border-color: #9CA3AF;
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pagination-btn:active:not(:disabled) {
    transform: translateY(0);
    background: #F3F4F6;
}

/* Responsive pagination */
@media (max-width: 768px) {
    .response-pagination {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pagination-controls {
        justify-content: center;
    }
    
    .pagination-btn {
        flex: 1;
        min-width: 0;
    }
}

#testApiContent::before {
    content: "🧪 Test API Active";
    position: absolute;
    top: -12px;
    left: 20px;
    background: #22C55E;
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.request-section, .response-section {
    flex: 1;
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    min-height: 600px;
}


.request-section h3, .response-section h3 {
    margin: 0 0 20px 0;
    color: #1f2937;
    font-size: 18px;
    font-weight: 600;
}

/* Ensure proper spacing in request section */
.request-section > *:not(:last-child) {
    margin-bottom: 20px;
}

.request-section > .action-buttons {
    margin-top: auto; /* Push action buttons to bottom */
}


/* Endpoint Section */

.endpoint-section {
    margin-bottom: 24px;
}

/* Current URL Display Section */
.current-url-section {
    margin-bottom: 24px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.current-url-section label {
    display: block;
    margin-bottom: 12px;
    color: #374151;
    font-weight: 500;
    font-size: 14px;
}

.url-display-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.url-display-container code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    color: #1e293b;
    background: none;
    padding: 0;
    flex: 1;
}

#currentMethodBadge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
    color: #fff;
}

/* Method badge colors */
#currentMethodBadge.get { background-color: #166534; }
#currentMethodBadge.post { background-color: #166534; }
#currentMethodBadge.put { background-color: #fca130; }
#currentMethodBadge.delete { background-color: #f93e3e; }
#currentMethodBadge.patch { background-color: #8b5cf6; }

/* Request URL Display in Response Section */
.request-url-display {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 12px 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.request-url-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.request-method-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    min-width: 45px;
    text-align: center;
}

.request-method-badge.get { background-color: #166534; }
.request-method-badge.post { background-color: #166534; }
.request-method-badge.put { background-color: #fca130; }
.request-method-badge.delete { background-color: #f93e3e; }
.request-method-badge.patch { background-color: #8b5cf6; }

.request-url-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    flex: 1;
}

.copy-url-btn {
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.copy-url-btn:hover {
    background: #3730a3;
    transform: translateY(-1px);
}

.copy-url-btn:active {
    transform: translateY(0);
}

.request-url-code {
    display: block;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
    color: #1e293b;
    word-break: break-all;
    line-height: 1.4;
}

.endpoint-section label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-weight: 500;
    font-size: 14px;
}


.endpoint-controls {

    display: flex;

    gap: 12px;

    align-items: center;

}


.endpoint-select {

    width: 100%;

    padding: 12px 16px;

    border: 1px solid #d1d5db;

    border-radius: 8px;

    background-color: #f9fafb;

    color: #374151;

    font-size: 14px;

}


/* Parameters Section */

.parameters-section h4 {

    margin: 0 0 16px 0;

    color: #1f2937;

    font-size: 16px;

    font-weight: 600;

}


.param-group {

    margin-bottom: 16px;

}


.param-group label {

    display: block;

    margin-bottom: 6px;

    color: #374151;

    font-weight: 500;

    font-size: 14px;

}


.required {

    color: #ef4444;

    font-weight: 600;

}


.param-input, .param-select {

    width: 100%;

    padding: 10px 12px;

    border: 1px solid #d1d5db;

    border-radius: 6px;

    background-color: #f9fafb;

    font-size: 14px;

    color: #374151;

    transition: border-color 0.2s ease;

    box-sizing: border-box;

}


.param-input:focus, .param-select:focus {

    outline: none;

    border-color: #10b981;

    background-color: white;

}


/* API Key Section */

.api-key-section {

    background-color: #f3f4f6;

    padding: 16px;

    border-radius: 8px;

    margin-top: 20px;

}


.api-key-section label {

    display: block;

    margin-bottom: 8px;

    color: #374151;

    font-weight: 500;

    font-size: 14px;

}


.api-key-input {

    width: 100%;

    padding: 10px 12px;

    border: 1px solid #d1d5db;

    border-radius: 6px;

    background-color: white;

    font-size: 14px;

    font-family: 'Monaco', 'Consolas', monospace;

    box-sizing: border-box;

}

.api-key-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.api-key-wrapper .api-key-input {
    /* Add padding on the right to make space for the icon */
    padding-right: 40px; 
}

.api-key-wrapper .fa-eye,
.api-key-wrapper .fa-eye-slash {
    position: absolute;
    right: 15px;
    cursor: pointer;
    color: #6b7280;
}

/* Action Buttons */

.action-buttons {

    display: flex;

    gap: 12px;

    margin-top: 24px;

}


.run-btn {

    background: linear-gradient(135deg, #10b981 0%, #059669 100%);

    color: white;

    border: none;

    padding: 12px 20px;

    border-radius: 8px;

    font-weight: 600;

    cursor: pointer;

    display: flex;

    align-items: center;

    gap: 8px;

    transition: all 0.3s ease;

    flex: 1;

    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);

    position: relative;

    overflow: hidden;

}


.run-btn::before {

    content: "🚀";

    margin-right: 6px;

    font-size: 1.1em;

}


.run-btn:hover {

    background: linear-gradient(135deg, #059669 0%, #047857 100%);

    transform: translateY(-2px);

    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);

}


.reset-btn {

    background-color: transparent;

    color: #6b7280;

    border: 1px solid #d1d5db;

    padding: 12px 20px;

    border-radius: 8px;

    font-weight: 500;

    cursor: pointer;

    display: flex;

    align-items: center;

    gap: 8px;

    transition: all 0.2s ease;

}


.reset-btn:hover {

    background-color: #f9fafb;

    color: #374151;

}


/* Response Section */

.response-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 20px;

}

.response-controls {
    display: flex;
    gap: 8px;
    margin-left: auto;
}
.response-search {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
}
.response-action-btn {
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}
.response-action-btn:hover {
    background-color: #e5e7eb;
}
pre mark {
    background-color: #fde047;
    padding: 0;
    border-radius: 2px;
}


.response-tabs {

    display: flex;

    gap: 0;

}


.response-tab {

    background: none;

    border: none;

    padding: 8px 16px;

    color: #6b7280;

    cursor: pointer;

    border-bottom: 2px solid transparent;

    font-size: 12px;

    font-weight: 500;

    text-transform: uppercase;

    transition: all 0.2s ease;

}


.response-tab.active {

    color: #10b981;

    border-bottom-color: #10b981;

}


.response-content {

    border: 1px solid #e5e7eb;

    border-radius: 8px;

    overflow: hidden;

}


.status-indicator {

    background-color: #f9fafb;

    padding: 12px 16px;

    border-bottom: 1px solid #e5e7eb;

}


.status-code {

    background-color: #dcfce7;

    color: #166534;

    padding: 4px 8px;

    border-radius: 4px;

    font-size: 12px;

    font-weight: 600;

}


.response-body {
    padding: 16px;
    flex: 1; /* Make it grow to fill available space */
    display: flex;
    flex-direction: column;
    min-height: 400px; /* Increased minimum height */
    overflow: hidden; /* Prevent overflow issues */
}


.response-view {
    display: none;
    flex: 1; /* Allow it to grow */
    overflow: hidden; /* Prevent container from growing beyond bounds */
}

.response-view.active {
    display: flex;
    flex-direction: column;
    height: 100%; /* Take full height of parent */
}

.response-view pre {

    background: #f8f9fa;

    border: 1px solid #e5e5e5;

    border-radius: 8px;

    padding: 16px;

    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;

    font-size: 13px;

    line-height: 1.5;

    color: #333;

    white-space: pre-wrap;

    word-wrap: break-word;

    max-height: 400px;

    overflow-y: auto;

    margin: 0;

}


/* Loading States */

.loading {

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 40px;

    color: #6b7280;

    font-size: 14px;

}


.loading-overlay {

    position: fixed;

    top: 0;

    left: 0;

    width: 100%;

    height: 100%;

    background: rgba(0, 0, 0, 0.5);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-direction: column;

    z-index: 1000;

}


.spinner {

    width: 40px;

    height: 40px;

    border: 4px solid #f3f4f6;

    border-top: 4px solid #22c55e;

    border-radius: 50%;

    animation: spin 1s linear infinite;

}


.loading-overlay p {

    color: white;

    margin-top: 16px;

    font-size: 16px;

}


@keyframes spin {

    0% { transform: rotate(0deg); }

    100% { transform: rotate(360deg); }

}


/* Responsive Design */

@media (max-width: 768px) {

    .api-test-container {

        padding: 10px;

    }

    .api-content {

        flex-direction: column;

    }

    .action-buttons {

        flex-direction: column;

    }

    .response-header {

        flex-direction: column;

        align-items: flex-start;

        flex-wrap: wrap; /* Allow items to wrap on smaller screens */

        gap: 16px;

    }

    .response-controls {

        display: flex;

        gap: 8px;

        margin-left: auto; /* Push controls to the right */

    }

    .response-search {

        padding: 6px 10px;

        border: 1px solid #d1d5db;

        border-radius: 6px;

        font-size: 13px;

    }

    .response-action-btn {

        background-color: #f3f4f6;

        border: 1px solid #d1d5db;

        color: #374151;

        padding: 6px 12px;

        border-radius: 6px;

        cursor: pointer;

        font-size: 13px;

        font-weight: 500;

        transition: background-color 0.2s ease;

    }

    .response-action-btn:hover {

        background-color: #e5e7eb;

    }

    pre mark {

        background-color: #fde047;

        padding: 0;

        border-radius: 2px;

    }

    /* Add to static/css/test_api.css */

.endpoint-details {
    margin-bottom: 32px;
}

.endpoint-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.endpoint-header code {
    font-size: 16px;
    font-weight: 600;
    padding: 8px 12px;
}

/* Style for code blocks */
pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

pre code {
    background-color: transparent !important;
    padding: 0 !important;
}

/* Parameters Table */
.parameters-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}

.parameters-table th, .parameters-table td {
    border: 1px solid #e0e0e0;
    padding: 10px 12px;
    text-align: left;
}

.parameters-table th {
    background-color: #f9fafb;
    font-weight: 600;
}

.parameters-table code {
    background-color: #eef1f3;
    padding: 2px 6px;
    border-radius: 4px;
}

.required {
    color: #d9534f;
    font-weight: bold;
    margin-left: 4px;
}
}