/* Base styles and layout */
* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    font-size: 13px;
    line-height: 1.4;
    background: #f5f5f5;
    color: #333;
}

.container { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 10px; 
    height: 100vh; 
    padding: 10px;
    overflow: hidden;
}

.panel { 
    background: white; 
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    background: #2c3e50;
    color: white;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
}

/* Stats */
.stats {
    color: white;
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    text-align: center;
}

/* Filter Grid - 3x2 layout */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
    font-size: 11px;
    color: #6c757d;
    position: relative;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.filter-item .filter-label {
    font-weight: 500;
    color: #495057;
    min-width: fit-content;
}

.filter-item input,
.filter-item select {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 11px;
}

.filter-item input[type="number"] {
    width: 100%;
}

.cpc-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.cpc-inputs input {
    flex: 1;
    min-width: 40px;
}

.filter-item.checkbox label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.filter-item.checkbox input {
    width: auto;
    flex: none;
}

.api-debug-toggle {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 9px;
    color: #adb5bd;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.api-debug-toggle:hover {
    opacity: 1;
    color: #6c757d;
}

.stat {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #2c3e50;
}

.stat-label {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    margin-top: 2px;
}

/* Search Form */
.search-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    border-bottom: 2px solid #e9ecef;
    position: relative;
}

.search-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.filter-label {
    font-size: 11px;
    color: #6c757d;
    margin-right: 4px;
    min-width: 30px;
}

/* Actions */
.actions {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.refresh-time {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    font-weight: normal;
}

/* Settings Grid - similar to filter grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.schedule-grid .setting-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.settings-grid .setting-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.setting-item .setting-label {
    font-weight: 500;
    color: #495057;
    font-size: 11px;
    min-width: fit-content;
}

.setting-item input,
.setting-item select {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 11px;
}

.setting-item.checkbox label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.setting-item.checkbox input {
    width: auto;
    flex: none;
}

.schedule-enable {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 12px;
    cursor: pointer;
}

.schedule-enable input {
    width: auto;
}

/* Sections */
.section {
    margin-bottom: 15px;
}

.section:first-child {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    border-bottom: 2px solid #e9ecef;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
}

.section-title.collapsible {
    cursor: pointer;
    user-select: none;
}

.section-title.collapsible::before {
    content: '▶';
    display: inline-block;
    margin-right: 5px;
    transition: transform 0.2s;
    font-size: 10px;
}

.section-title.collapsible.expanded::before {
    transform: rotate(90deg);
}

.section-content {
    display: none;
}

.section-content.show {
    display: block;
}

.header-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.small-btn {
    background: #3498db;
    border: none;
    padding: 4px 10px;
    border-radius: 3px;
    color: white;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
}

.small-btn:hover {
    background: #2980b9;
}

.small-btn:active {
    background: #2471a3;
}

.small-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Status Box */
.status-box {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 10px;
}

.status-box div {
    margin-bottom: 4px;
}

.status-box strong {
    color: #2c3e50;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Integration styles */
.integration-content {
    font-size: 12px;
    line-height: 1.6;
}

.api-section {
    margin-bottom: 20px;
}

.api-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.api-section h5 {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.api-endpoint {
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 12px;
    display: inline-block;
}

.endpoint-item {
    margin-bottom: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

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

.method {
    background: #3498db;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.endpoint-path {
    font-family: monospace;
    font-size: 12px;
    color: #2c3e50;
}

.endpoint-desc {
    font-size: 11px;
    color: #6c757d;
}

.params-table {
    width: 100%;
    font-size: 11px;
}

.params-table code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 2px;
    font-family: monospace;
}

.category-list {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    line-height: 1.8;
}

.example-item {
    margin-bottom: 12px;
}

.example-code {
    display: block;
    background: #2c3e50;
    color: #fff;
    padding: 8px 10px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 11px;
    margin-top: 4px;
    word-break: break-all;
    white-space: pre-wrap;
}

.response-example {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    overflow-x: auto;
    margin: 0;
}

.rate-limit-info {
    font-size: 12px;
}

.rate-limit-info ul {
    margin: 8px 0 0 20px;
}

.rate-limit-info li {
    margin-bottom: 4px;
}