/**
 * Prompt Library Management Styles
 * Styles for the prompt management panel, forms, and list
 */

/* Prompt Management Panel */
.prompt-management-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 100%;
    max-width: 900px;
    height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-left: 3px solid #667eea;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: slideInPanel 0.3s ease-out;
    overflow: hidden;
}

@keyframes slideInPanel {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.prompt-management-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Panel Header */
.prompt-management-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.prompt-management-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.btn-close-panel {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-close-panel:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* Prompt List Container */
.prompt-list-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 20px;
    min-height: 0;
}

/* Toolbar */
.prompt-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.prompt-search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    background: white;
}

.prompt-search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.prompt-category-filter {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.prompt-category-filter:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.prompt-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.prompt-checkbox:hover {
    background: rgba(102, 126, 234, 0.1);
}

.prompt-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* Prompts List */
.prompts-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 10px;
    min-height: 0;
}

.prompts-list::-webkit-scrollbar {
    width: 8px;
}

.prompts-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.prompts-list::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
}

.prompts-list::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

.no-prompts-message {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 16px;
}

/* Prompt Item */
.prompt-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.prompt-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.prompt-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.prompt-title strong {
    color: #333;
    font-size: 14px;
    word-break: break-word;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-system {
    background: #e8f4f8;
    color: #0277bd;
}

.badge-user {
    background: #f3e5f5;
    color: #6a1b9a;
}

.prompt-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-small {
    background: none;
    border: none;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-small.btn-primary {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.btn-small.btn-primary:hover {
    background: rgba(102, 126, 234, 0.2);
}

.btn-small.btn-danger {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

.btn-small.btn-danger:hover {
    background: rgba(244, 67, 54, 0.2);
}

.btn-small.btn-success {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}

.btn-small.btn-success:hover {
    background: rgba(76, 175, 80, 0.2);
}

.prompt-description {
    color: #666;
    font-size: 13px;
    margin-bottom: 8px;
    line-height: 1.4;
}

.prompt-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #999;
}

.category-badge {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    color: #666;
}

.usage-count {
    display: flex;
    align-items: center;
}

/* Form Container */
.prompt-form-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 20px;
    min-height: 0;
}

.prompt-form-header {
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 15px;
    flex-shrink: 0;
}

.prompt-form-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.prompt-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    min-height: 0;
}

.prompt-form::-webkit-scrollbar {
    width: 8px;
}

.prompt-form::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.prompt-form::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
}

.prompt-form::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.form-group label {
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

.form-group small {
    color: #999;
    font-size: 12px;
    font-style: italic;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #e0e0e0;
    flex-shrink: 0;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex: 1;
}

.btn.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.btn.btn-secondary {
    background: #f0f0f0;
    color: #666;
    flex: 1;
}

.btn.btn-secondary:hover {
    background: #e0e0e0;
}

.btn.btn-success {
    background: #4caf50;
    color: white;
}

.btn.btn-success:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn.btn-danger {
    background: #f44336;
    color: white;
}

.btn.btn-danger:hover {
    background: #da190b;
}

/* Responsive */
@media (max-width: 768px) {
    .prompt-management-panel {
        max-width: 100%;
        border-left: none;
        border-top: 3px solid #667eea;
    }

    @keyframes slideInPanel {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    .prompt-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .prompt-search-input,
    .prompt-category-filter {
        min-width: auto;
    }

    .btn {
        padding: 12px 16px;
    }
}

/* Loading and Empty States */
.prompt-loading {
    text-align: center;
    padding: 40px 20px;
    color: #667eea;
}

.prompt-error {
    background: #ffebee;
    border: 1px solid #ef5350;
    color: #c62828;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
}

/* ===== DEDICATED PROMPT LIBRARY PAGE STYLES ===== */

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    color: #334155;
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="checkbox"] {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.95rem;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 30px;
    padding: 15px 0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 20px;
}

.stat-item {
    color: #64748b;
    font-size: 0.95rem;
}

.stat-item strong {
    color: #2563eb;
    font-weight: 700;
}

/* Prompts List */
.prompts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.prompt-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.prompt-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}

.prompt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 10px;
    margin-bottom: 12px;
}

.prompt-card-header h3 {
    margin: 0;
    color: #1e293b;
    font-size: 1.1rem;
    flex: 1;
}

.prompt-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.prompt-badge.system {
    background: #dbeafe;
    color: #0c4a6e;
}

.prompt-badge.custom {
    background: #fce7f3;
    color: #831843;
}

.prompt-description {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prompt-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.category-tag {
    background: #f1f5f9;
    color: #475569;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.version {
    color: #94a3b8;
    font-size: 0.8rem;
}

.author {
    color: #7c3aed;
    font-size: 0.8rem;
}

.prompt-stats {
    display: flex;
    gap: 15px;
    padding: 10px 0;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    margin: 12px 0;
    font-size: 0.9rem;
    color: #64748b;
}

.prompt-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.btn-action {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #2563eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.btn-action.danger {
    color: #dc2626;
    border-color: #fecaca;
}

.btn-action.danger:hover {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-content.large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.modal-header h2 {
    margin: 0;
    color: #1e293b;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #1e293b;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 15px 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #1e293b;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

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

.form-group small {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 0.8rem;
}

/* Variables Section */
.variables-section {
    margin: 20px 0;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
}

.variables-section h3 {
    margin-top: 0;
    color: #1e293b;
}

.variable-item {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.variable-item input {
    flex: 1;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
}

.var-name {
    flex: 0.4;
}

.var-description {
    flex: 0.6;
}

/* View Content */
.view-content {
    color: #1e293b;
}

.prompt-details p {
    margin: 12px 0;
    line-height: 1.6;
}

.prompt-details h3 {
    margin: 20px 0 10px 0;
    color: #1e293b;
}

.template-view {
    background: #f1f5f9;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #334155;
}

.variables-view {
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
}

.variable-info {
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.variable-info:last-child {
    border-bottom: none;
}

.variable-info strong {
    color: #2563eb;
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #e2e8f0;
    color: #334155;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-width: 300px;
    animation: slideInToast 0.3s ease-out;
}

@keyframes slideInToast {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.toast-message {
    color: #64748b;
    font-size: 0.9rem;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #cbd5e1;
    transition: color 0.2s ease;
}

.toast-close:hover {
    color: #94a3b8;
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #dc2626;
}

.toast.warning {
    border-left: 4px solid #f59e0b;
}

.toast.info {
    border-left: 4px solid #2563eb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .prompts-list {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
    }

    .modal-content {
        max-width: 95vw;
    }

    .toast-container {
        left: 10px;
        right: 10px;
    }

    .toast {
        min-width: auto;
    }
}


