* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #e4e4e4;
}

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

header {
    text-align: center;
    padding: 20px 0 30px;
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(90deg, #00d4ff, #7b2fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff4444;
}

.status-dot.active {
    background: #44ff44;
    box-shadow: 0 0 10px #44ff44;
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: #e4e4e4;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tab-btn.active {
    background: linear-gradient(90deg, #00d4ff, #7b2fff);
    color: white;
}

/* Main Layout */
.main-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.sidebar {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
}

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

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #00d4ff;
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #aaa;
}

.form-group.required label::after {
    content: " *";
    color: #ff6b6b;
}

select,
input[type="text"],
input[type="number"],
textarea {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e4e4e4;
    font-size: 0.95rem;
}

select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: #00d4ff;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(90deg, #00d4ff, #7b2fff);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e4e4e4;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Slider */
.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-container input[type="range"] {
    flex: 1;
}

input[type="range"] {
    -webkit-appearance: none;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    height: 8px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #00d4ff;
    border-radius: 50%;
    cursor: pointer;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #00d4ff;
}

.checkbox-group label {
    margin-bottom: 0;
    color: #e4e4e4;
    cursor: pointer;
}

/* Row Layout */
.row {
    display: flex;
    gap: 10px;
}

.row .form-group {
    flex: 1;
}

/* Output Area */
.output-area {
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    min-height: 300px;
}

.image-container img {
    max-width: 100%;
    max-height: 600px;
    object-fit: contain;
    cursor: pointer;
}

.placeholder {
    color: #666;
    text-align: center;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 10px;
    color: #444;
}

/* Loading */
.loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.loading.active {
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Messages */
.error-message {
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid #ff4444;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    color: #ff6b6b;
}

.success-message {
    background: rgba(68, 255, 68, 0.2);
    border: 1px solid #44ff44;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    color: #6bff6b;
}

/* Tabs Content */
.tab-content {
    display: none;
}

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

/* Info Text */
.info-text {
    font-size: 0.8rem;
    color: #888;
    margin-top: 4px;
}

.model-count {
    font-size: 0.8rem;
    color: #00d4ff;
    margin-left: 8px;
}

/* Model Config Section */
.model-config-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

.model-config-section .section-title {
    font-size: 0.95rem;
    margin-bottom: 10px;
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.gallery-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.modal.active {
    display: flex;
}

.modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 2rem;
    color: white;
    cursor: pointer;
}

/* Log Output */
.log-output {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 15px;
    font-family: monospace;
    font-size: 0.85rem;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

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

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #dc3545; /* Red for offline (default) */
    display: inline-block;
    margin-right: 8px;
}

.status-dot.active {
    background-color: #28a745; /* Green for online */
}

.status-dot.busy {
    background-color: #ff9800; /* Orange for busy */
}
