/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

/* Header styles */
.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    font-weight: 300;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header h1 i {
    margin-right: 15px;
    color: #ffd700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    font-weight: 300;
}

/* Tabs container */
.tabs-container {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Tab navigation */
.tabs {
    display: flex;
    flex-wrap: wrap;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    padding: 0;
}

.tab-button {
    flex: 1;
    min-width: 150px;
    padding: 15px 20px;
    border: none;
    background: transparent;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-button:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.tab-button.active {
    background: white;
    color: #4facfe;
    font-weight: 600;
}

.tab-button i {
    font-size: 16px;
}

/* Tab content */
.tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s ease-in;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* API Section styles */
.api-section h2 {
    color: #2c3e50;
    font-size: 2em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.api-section h2 i {
    color: #4facfe;
}

.description {
    font-size: 1.1em;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Endpoints */
.endpoints {
    display: grid;
    gap: 25px;
}

.endpoint {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    border-left: 4px solid #4facfe;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.endpoint:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.endpoint h3 {
    color: #2c3e50;
    font-size: 1.3em;
    margin-bottom: 10px;
    font-family: 'Courier New', monospace;
    background: #e3f2fd;
    padding: 8px 12px;
    border-radius: 5px;
    display: inline-block;
}

.endpoint p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

.endpoint-details {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #e9ecef;
}

.endpoint-details h4 {
    color: #495057;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.endpoint-details ul {
    list-style: none;
    padding-left: 0;
}

.endpoint-details li {
    padding: 5px 0;
    border-bottom: 1px solid #f1f3f4;
    position: relative;
    padding-left: 20px;
}

.endpoint-details li:before {
    content: "▸";
    color: #4facfe;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.endpoint-details li:last-child {
    border-bottom: none;
}

.endpoint-details strong {
    color: #2c3e50;
}

/* Input groups */
.input-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.input-group input,
.input-group select {
    flex: 1;
    min-width: 250px;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: white;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

/* Dropdown specific styling */
.dropdown-select {
    cursor: pointer;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iNiIgdmlld0JveD0iMCAwIDEwIDYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xIDFMNSA1TDkgMSIgc3Ryb2tlPSIjNjk3Njg2IiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPgo=');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 35px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.dropdown-select option {
    padding: 10px;
    font-size: 14px;
}

/* Loading state for dropdowns */
.dropdown-loading {
    background-image: none;
    background-color: #f8f9fa;
    color: #6c757d;
}

.dropdown-loading::after {
    content: " Laddar alternativ...";
    font-style: italic;
}

/* Filter section styles */
.filter-section {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

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

.filter-group h5 {
    color: #495057;
    font-size: 1em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group h5 i {
    color: #4facfe;
    font-size: 14px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
    user-select: none;
}

.checkbox-label:hover {
    background: #f8f9fa;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4facfe;
}

.checkbox-label span {
    font-size: 14px;
    color: #495057;
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

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

.filter-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.filter-btn i {
    font-size: 12px;
}

.preset-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 3px 0;
}

.preset-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(40, 167, 69, 0.3);
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.filter-actions h5 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 0.9em;
}

/* Buttons */
.fetch-btn {
    background: linear-gradient(45deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.fetch-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(79, 172, 254, 0.3);
}

.fetch-btn:active {
    transform: translateY(0);
}

.fetch-btn i {
    font-size: 14px;
}

/* Secondary button (for dropdown loading) */
.fetch-btn.secondary {
    background: #6c757d;
    min-width: 45px;
    padding: 12px;
    justify-content: center;
}

.fetch-btn.secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
}

/* Results section */
.results-section {
    background: white;
    border-radius: 15px;
    margin-top: 30px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.results-section h2 {
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 20px 30px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.results-header {
    background: #f8f9fa;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
    gap: 15px;
}

.results-info {
    font-weight: 500;
    color: #495057;
    flex: 1;
}

/* View toggle buttons */
.view-toggle {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.toggle-btn {
    padding: 8px 15px;
    border: 2px solid #e9ecef;
    background: white;
    color: #495057;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.toggle-btn:hover {
    border-color: #4facfe;
    color: #4facfe;
}

.toggle-btn.active {
    background: #4facfe;
    border-color: #4facfe;
    color: white;
}

.toggle-btn i {
    font-size: 12px;
}

.close-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.close-btn:hover {
    background: #c82333;
}

.results-content {
    padding: 30px;
    max-height: 500px;
    overflow-y: auto;
}

.results-content pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    color: #495057;
}

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

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

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

/* Error states */
.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

/* Table styles */
.table-container {
    margin: 0;
}

.table-title {
    color: #2c3e50;
    font-size: 1.2em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4facfe;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: white;
}

.data-table th {
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    border: none;
    white-space: nowrap;
}

.data-table td {
    padding: 10px;
    border-bottom: 1px solid #f1f3f4;
    border-right: 1px solid #f1f3f4;
    vertical-align: top;
}

.data-table td:last-child {
    border-right: none;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table tr:nth-child(even) {
    background: #fafbfc;
}

.data-table tr:nth-child(even):hover {
    background: #f1f3f4;
}

/* Table cell formatting */
.null-value {
    color: #868e96;
    font-style: italic;
}

.difficulty-0 { color: #28a745; font-weight: 500; }
.difficulty-1 { color: #ffc107; font-weight: 500; }
.difficulty-2 { color: #fd7e14; font-weight: 500; }
.difficulty-3 { color: #dc3545; font-weight: 500; }

.status-open { color: #28a745; font-weight: 500; }
.status-closed { color: #dc3545; font-weight: 500; }
.status-ongoing { color: #17a2b8; font-weight: 500; }
.status-unknown { color: #6c757d; font-weight: 500; }

.no-data {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-button {
        min-width: auto;
        justify-content: flex-start;
        padding: 12px 20px;
    }
    
    .tab-content {
        padding: 20px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group input {
        min-width: auto;
    }
    
    .endpoint-details ul {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    .api-section h2 {
        font-size: 1.5em;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .endpoint {
        padding: 15px;
    }
    
    .endpoint-details {
        padding: 15px;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px 20px;
    }
    
    .view-toggle {
        margin-top: 5px;
    }
    
    .toggle-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }
    
    .table-title {
        font-size: 1.1em;
        margin-bottom: 10px;
    }
    
    .filter-section {
        padding: 15px;
    }
    
    .filter-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-btn {
        width: 100%;
        justify-content: center;
    }
    
    .checkbox-label {
        padding: 8px 5px;
    }
    
    .checkbox-label span {
        font-size: 13px;
    }
    
    .preset-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 6px;
    }
}

/* Sync button styles */
.btn-sync-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.btn-sync-item:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-sync-item:active {
    transform: translateY(0);
}

.btn-sync-item i {
    font-size: 11px;
}

.btn-sync-item:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}