/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.header-content h1 {
    font-size: 2.5em;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 700;
}

.header-content h1 i {
    color: #3498db;
    margin-right: 15px;
}

.header-content p {
    color: #7f8c8d;
    font-size: 1.1em;
}

/* Configuration Panel */
.config-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.base-url-display {
    padding: 8px 12px;
    background-color: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
    color: #333;
    user-select: all;
    word-break: break-all;
}

.config-panel h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-panel h2 i {
    color: #e74c3c;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.config-item {
    position: relative;
}

.config-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
}

.config-item input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.config-item input:focus {
    outline: none;
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 38px;
    background: none;
    border: none;
    color: #7f8c8d;
    cursor: pointer;
    padding: 5px;
    font-size: 14px;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #3498db;
}

/* Debug Panel */
.debug-panel {
    background: #2c3e50;
    border-radius: 15px;
    margin-bottom: 30px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.debug-header {
    background: #34495e;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-header h3 {
    color: #ecf0f1;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.debug-header h3 i {
    color: #e74c3c;
}

.clear-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.clear-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.debug-content {
    padding: 20px 25px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.debug-item {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    gap: 15px;
}

.debug-item.info {
    background: rgba(52, 152, 219, 0.1);
    border-left: 3px solid #3498db;
}

.debug-item.success {
    background: rgba(46, 204, 113, 0.1);
    border-left: 3px solid #2ecc71;
}

.debug-item.warning {
    background: rgba(241, 196, 15, 0.1);
    border-left: 3px solid #f1c40f;
}

.debug-item.error {
    background: rgba(231, 76, 60, 0.1);
    border-left: 3px solid #e74c3c;
}

.timestamp {
    color: #95a5a6;
    font-weight: bold;
    min-width: 80px;
}

.message {
    color: #ecf0f1;
    flex: 1;
}

/* Endpoints Container */
.endpoints-container {
    margin-bottom: 30px;
}

.endpoint-category {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.endpoint-category h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.6em;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
}

/* Response Panel */
.response-panel {
    background: #2c3e50;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: sticky;
    bottom: 20px;
}

.response-header {
    background: #34495e;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.response-header h3 {
    color: #ecf0f1;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.response-header h3 i {
    color: #2ecc71;
}

.response-controls {
    display: flex;
    gap: 10px;
}

.copy-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.response-content {
    padding: 20px 25px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    color: #ecf0f1;
}

.no-response {
    text-align: center;
    color: #7f8c8d;
    padding: 40px 20px;
    font-style: italic;
}

.no-response i {
    display: block;
    font-size: 2em;
    margin-bottom: 10px;
}

.response-json {
    background: #34495e;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #4a5568;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Form Validation States */
.form-group input.error,
.form-group textarea.error {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-group input.success,
.form-group textarea.success {
    border-color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

.field-error {
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 5px;
    padding: 5px;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 4px;
    border-left: 3px solid #dc3545;
}

/* Auth status indicator */
#authIndicator {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
}

#authIndicator button {
    background: #007bff;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
}

#authIndicator button:hover {
    background: #0056b3;
}

/* Enhanced debug console */
.debug-item.info {
    border-left-color: #17a2b8;
    background-color: rgba(23, 162, 184, 0.1);
}

.debug-item.success {
    border-left-color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
}

.debug-item.warning {
    border-left-color: #ffc107;
    background-color: rgba(255, 193, 7, 0.1);
}

.debug-item.error {
    border-left-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

/* Loading states */
.endpoint-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.endpoint-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Collapsible category headers */
.endpoint-category h2 {
    transition: all 0.3s ease;
    user-select: none;
}

.endpoint-category h2:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px;
    margin: -10px;
}

.endpoint-category h2 i {
    transition: transform 0.3s ease;
    margin-right: 10px;
}

/* File input styling */
input[type="file"] {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="file"]:hover {
    border-color: #3498db;
    background-color: rgba(52, 152, 219, 0.05);
}

/* Notification enhancements */
.notification {
    z-index: 9999;
    max-width: 400px;
    word-wrap: break-word;
}

.notification.success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.notification.error {
    background: linear-gradient(135deg, #dc3545, #fd7e14);
}

.notification.warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
}

.notification.info {
    background: linear-gradient(135deg, #17a2b8, #007bff);
}

/* Response panel enhancements */
.response-status {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 600;
}

.response-status.success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), rgba(32, 201, 151, 0.1));
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.response-status.warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(253, 126, 20, 0.1));
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.response-status.error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(253, 126, 20, 0.1));
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.status-code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 1.2em;
    padding: 5px 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.2);
}

.response-time {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.9em;
}

/* Scrollbar Styles */
.debug-content::-webkit-scrollbar,
.response-content::-webkit-scrollbar {
    width: 8px;
}

.debug-content::-webkit-scrollbar-track,
.response-content::-webkit-scrollbar-track {
    background: #34495e;
}

.debug-content::-webkit-scrollbar-thumb,
.response-content::-webkit-scrollbar-thumb {
    background: #7f8c8d;
    border-radius: 4px;
}

.debug-content::-webkit-scrollbar-thumb:hover,
.response-content::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* Loading Animation */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading .test-btn {
    background: #95a5a6 !important;
    cursor: not-allowed;
}

.loading .test-btn::after {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header-content h1 {
        font-size: 2em;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
    
    .response-panel {
        position: static;
        margin-top: 20px;
    }
    
    .endpoint-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .method {
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px;
    }
    
    .config-panel,
    .endpoint-category {
        padding: 20px;
    }
    
    .debug-content,
    .response-content {
        padding: 15px 20px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    .header {
        background: rgba(44, 62, 80, 0.95);
        color: #ecf0f1;
    }
    
    .header-content h1 {
        color: #ecf0f1;
    }
    
    .config-panel,
    .endpoint-card,
    .debug-panel,
    .response-panel {
        background: rgba(44, 62, 80, 0.9);
        color: #ecf0f1;
    }
    
    input, textarea {
        background: rgba(52, 73, 94, 0.8);
        color: #ecf0f1;
        border-color: #5d6d7e;
    }
    
    .debug-item {
        background-color: rgba(52, 73, 94, 0.5);
    }
}