/* AI RSS Rewriter - Prompts Manager Styles */

:root {
    --background: #ffffff;
    --background-secondary: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #dee2e6;
    --primary-color: #20a651;
    --primary-dark: #1a8a42;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.prompts-manager {
    max-width: 100%;
}

.prompts-header {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: .75rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: .75rem;
}

.prompts-description {
    margin: 1rem 0 0 0;
    color: var(--text-secondary);
    font-size: .875rem;
}

.prompt-type-badge {
    background: var(--primary-color);
    color: white;
    padding: .25rem .5rem;
    border-radius: .375rem;
    font-size: .75rem;
    font-weight: 500;
    margin-left: .5rem;
}

.prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: .75rem;
}

.empty-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin: 0 0 .75rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.empty-state p {
    margin: 0 0 1.5rem 0;
    color: var(--text-secondary);
    font-size: .875rem;
}

.prompt-card {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: .75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all .3s ease;
    position: relative;
    overflow: hidden;
}

.prompt-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.prompt-title {
    flex: 1;
}

.prompt-title h3 {
    margin: 0 0 .5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.prompt-content {
    margin-bottom: 1.5rem;
}

.prompt-preview {
    font-size: .875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: .5rem;
    font-family: 'Courier New', monospace;
}

.prompt-meta {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: .5rem;
    border: 1px solid var(--border-color);
}

.prompt-variables {
    font-size: .875rem;
}

.prompt-variables strong {
    color: var(--text-primary);
    margin-bottom: .5rem;
    display: block;
}

.variable-tag {
    background: var(--primary-color);
    color: white;
    padding: .25rem .5rem;
    border-radius: .375rem;
    font-size: .75rem;
    font-family: 'Courier New', monospace;
    margin: .25rem .25rem 0 0;
    display: inline-block;
    cursor: pointer;
    transition: background .2s ease;
}

.variable-tag:hover {
    background: var(--primary-dark);
}

.prompt-actions {
    display: flex;
    gap: .5rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--background);
    border-radius: .75rem;
    box-shadow: var(--shadow-lg);
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: .375rem;
    transition: background .2s ease;
}

.modal-close:hover {
    background: var(--background-secondary);
}

.modal-form {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.prompts-manager .modal-form .form-group {
    margin-bottom: 1.5rem;
}

.prompts-manager .modal-form label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: .5rem;
}

.form-help {
    display: block;
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .25rem;
}

.prompts-manager .modal-form input,
.prompts-manager .modal-form select,
.prompts-manager .modal-form textarea {
    width: 100%;
    padding: .75rem;
    border: 1px solid var(--border-color);
    border-radius: .5rem;
    background: var(--background);
    color: var(--text-primary);
    font-size: .875rem;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.prompts-manager .modal-form input:focus,
.prompts-manager .modal-form select:focus,
.prompts-manager .modal-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(32, 166, 79, .1);
}

.prompts-manager .modal-form textarea {
    resize: vertical;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
}

/* Variables Info */
.variables-info {
    margin-top: .75rem;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: .5rem;
    border: 1px solid var(--border-color);
}

.variables-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .75rem;
}

.variables-list {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/* Test Results */
.test-results {
    padding: 1.5rem;
}

.test-section {
    margin-bottom: 1.5rem;
}

.test-section h4 {
    margin: 0 0 .75rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.code-block,
.response-block {
    background: var(--background-secondary);
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: .5rem;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: .875rem;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.5;
}

.test-actions {
    text-align: center;
    margin-top: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: .5rem;
    background: var(--background);
    color: var(--text-primary);
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all .2s ease;
    gap: .5rem;
}

.btn:hover {
    background: var(--background-secondary);
    border-color: var(--primary-color);
}

.btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-secondary {
    background: var(--background-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.btn-sm {
    padding: .375rem .75rem;
    font-size: .75rem;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .prompts-grid {
        grid-template-columns: 1fr;
    }
    
    .prompts-manager .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .prompts-header {
        padding: 1rem;
    }
    
    .prompt-actions {
        flex-direction: column;
    }
    
    .prompt-actions .btn {
        width: 100%;
        justify-content: center;
    }
}