:root {
    --apg-primary: #4a6fa5;
    --apg-secondary: #6b8cbc;
    --apg-success: #4caf50;
    --apg-warning: #ff9800;
    --apg-bg: #f8f9fa;
    --apg-text: #343a40;
    --apg-radius: 8px;
}

.apg-wrapper {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--apg-text);
    line-height: 1.6;
    max-width: 100%;
}

.apg-container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border-radius: var(--apg-radius);
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.apg-header {
    text-align: center;
    background: linear-gradient(135deg, var(--apg-primary), var(--apg-secondary));
    color: white;
    padding: 20px;
    border-radius: var(--apg-radius);
    margin-bottom: 30px;
}

.apg-header h1 { margin: 0; font-size: 2rem; color: white; }
.apg-header .subtitle { opacity: 0.9; margin: 5px 0 0; color: #eee; }

.apg-main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}
@media (max-width: 768px) { .apg-main-content { grid-template-columns: 1fr; } }

.apg-input-section, .apg-output-section {
    background: #fff;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: var(--apg-radius);
}

.apg-form-group { margin-bottom: 15px; }
.apg-form-group label { display: block; font-weight: 600; margin-bottom: 5px; }
.apg-form-group input[type="text"], .apg-form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.apg-categories, .apg-ai-platforms {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.apg-category-option, .apg-platform-option {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.apg-category-option:hover, .apg-platform-option:hover { background: #f0f5ff; }
.apg-category-option.selected, .apg-platform-option.selected {
    background: #e6f0ff;
    border-color: var(--apg-primary);
    color: var(--apg-primary);
    font-weight: 600;
}
.apg-category-option input, .apg-platform-option input { display: none; }

/* Aspect Ratio */
.apg-aspect-ratio-preview { margin-top: 15px; text-align: center; }
.apg-aspect-ratio-box {
    width: 120px; height: 120px;
    background: linear-gradient(45deg, #f0f5ff, #e6f0ff);
    border: 2px solid var(--apg-primary);
    margin: 0 auto 5px;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; color: var(--apg-primary);
}

/* Output Area */
.apg-output-area {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 15px;
    min-height: 200px;
    white-space: pre-wrap;
    font-family: monospace;
    margin-top: 15px;
    border-radius: 4px;
}

/* Buttons */
.apg-button-group { display: flex; gap: 10px; margin-top: 20px; }
.apg-generate-btn {
    flex: 2;
    background: var(--apg-primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
}
.apg-generate-btn:hover { opacity: 0.9; }
.apg-generate-btn:disabled { background: #ccc; cursor: not-allowed; }

.apg-copy-btn {
    flex: 1;
    background: #e9ecef;
    border: none;
    padding: 12px;
    border-radius: 4px;
    cursor: pointer;
}
.apg-copy-btn:hover { background: #dee2e6; }

/* Status & Quality */
.apg-prompt-quality { display: none !important; align-items: center; gap: 10px; margin-bottom: 10px; }
.apg-quality-badge { padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: bold; background: #eee; }
.apg-quality-badge.ai { background: var(--apg-success); color: white; }
.apg-quality-badge.fallback { background: var(--apg-warning); color: white; }
.apg-quality-badge.error { background: #f44336; color: white; }

.apg-api-status-bar {
    margin-top: 15px; padding: 10px; background: #f1f3f5;
    border-radius: 4px; font-size: 0.85rem; display: flex; gap: 10px; align-items: center;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #ccc; display: inline-block; }
.status-dot.active { background: var(--apg-success); }
.status-dot.inactive { background: #f44336; }

.apg-notification {
    position: fixed; top: 20px; right: 20px;
    padding: 15px; background: var(--apg-success); color: white;
    border-radius: 4px; transform: translateX(150%); transition: transform 0.3s; z-index: 9999;
}
.apg-notification.show { transform: translateX(0); }
.apg-loading {
    display: inline-block; width: 15px; height: 15px;
    border: 2px solid rgba(255,255,255,0.5); border-top-color: #fff;
    border-radius: 50%; animation: spin 1s linear infinite; margin-right: 5px;
}
@keyframes spin { to { transform: rotate(360deg); } }