/* Admin Page Styles */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: #f8f9fa;
    min-height: 100vh;
}

/* Error Display Styles */
.error-display {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    padding: 40px;
    text-align: center;
}

.error-content {
    max-width: 600px;
    margin: 0 auto;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #dc3545;
}

.error-message h3 {
    color: #dc3545;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.error-message p {
    color: #6c757d;
    margin-bottom: 15px;
    line-height: 1.6;
}

.error-url {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.error-url code {
    flex: 1;
    background: none;
    color: #495057;
    word-break: break-all;
    text-align: left;
}

.btn-copy {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-copy:hover {
    background: #0056b3;
}

.error-help {
    font-size: 0.875rem;
    color: #6c757d;
    font-style: italic;
}

.admin-header {
    background: white;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 20px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.header-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.admin-header h1 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5rem;
    white-space: nowrap;
}

.client-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.client-selector label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #2c3e50;
}

.client-selector select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #2c3e50;
    font-size: 0.9rem;
    min-width: 120px;
}

.client-selector select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.admin-nav {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 10px;
}

.nav-tab {
    padding: 10px 20px;
    border: none;
    background: #e9ecef;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-tab:hover {
    background: #dee2e6;
}

.nav-tab.active {
    background: #007bff;
    color: white;
}

.admin-main {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.tab-content {
    display: none;
    min-height: 400px;
}

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

/* Leads Section */
.leads-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: #f8f9fa;
}

.filter-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.leads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.lead-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lead-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.lead-card.qualified {
    border-left: 4px solid #28a745;
}

.lead-card.inspect {
    border-left: 4px solid #ffc107;
}

.lead-card.disqualified {
    border-left: 4px solid #dc3545;
}

.lead-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 10px;
}

.lead-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.lead-score {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.lead-score.hot {
    background: #d4edda;
    color: #155724;
}

.lead-score.warm {
    background: #fff3cd;
    color: #856404;
}

.lead-score.cold {
    background: #f8d7da;
    color: #721c24;
}

.lead-details {
    margin: 10px 0;
}

.lead-detail {
    display: flex;
    margin: 5px 0;
    font-size: 0.9rem;
}

.lead-detail strong {
    width: 80px;
    color: #6c757d;
}

.lead-detail span {
    flex: 1;
}

.lead-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
    font-size: 0.8rem;
    color: #6c757d;
}

.lead-actions {
    display: flex;
    gap: 5px;
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.8rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-small.primary {
    background: #007bff;
    color: white;
}

.btn-small.secondary {
    background: #6c757d;
    color: white;
}

/* Knowledge Base Section */
.kb-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.kb-actions {
    display: flex;
    gap: 10px;
}

.kb-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.kb-entries h3,
.kb-files h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.table-container {
    overflow-x: auto;
}

#kbTable {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

#kbTable th,
#kbTable td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

#kbTable th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

#kbTable tr:hover {
    background: #f8f9fa;
}

/* Settings Section */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.settings-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.settings-section h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    border-bottom: 2px solid #007bff;
    padding-bottom: 5px;
}

.settings-card {
    background: white;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 0.8rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

/* Conversation Transcript */
.conversation-selector {
    margin-bottom: 20px;
}

.conversation-selector label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.conversation-transcript {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    background: #f8f9fa;
}

.conversation-message {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 6px;
}

.conversation-message.user {
    background: #e3f2fd;
    margin-left: 20px;
}

.conversation-message.ai {
    background: #f3e5f5;
    margin-right: 20px;
}

.message-header {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 5px;
}

.message-content {
    color: #2c3e50;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* KB File Items */
.kb-file-item {
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.kb-file-item span {
    font-weight: 500;
    color: #2c3e50;
}

.kb-file-item small {
    color: #6c757d;
    display: block;
    margin-top: 5px;
}

/* Text Center Utility */
.text-center {
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .admin-container {
        padding: 10px;
    }

    .kb-content {
        grid-template-columns: 1fr;
    }

    .leads-grid {
        grid-template-columns: 1fr;
    }

    .admin-nav {
        flex-wrap: wrap;
    }

    .nav-tab {
        flex: 1;
        min-width: 100px;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #495057;
}

.empty-state p {
    margin-bottom: 20px;
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Analytics Section Styles */
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #007bff;
}

.analytics-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.8rem;
}

.analytics-actions {
    display: flex;
    gap: 10px;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.stat-content h3 {
    margin: 0;
    font-size: 2.2rem;
    font-weight: bold;
    line-height: 1;
}

.stat-content p {
    margin: 5px 0 0 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.analytics-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.analytics-section h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.3rem;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: 400px;
    position: relative;
}

.kb-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.kb-stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    border-left: 4px solid #007bff;
}

.kb-stat-card h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1rem;
}

.kb-stat-card p {
    margin: 0;
    font-size: 1.8rem;
    font-weight: bold;
    color: #007bff;
}

.response-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.response-stat {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.response-stat h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1rem;
}

.response-stat p {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    color: #28a745;
}

.activity-list {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 15px;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 5px 0;
}

.activity-description {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0;
}

.activity-time {
    color: #6c757d;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Chart responsive adjustments */
@media (max-width: 768px) {
    .stats-overview {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .stat-card {
        padding: 20px;
    }

    .stat-content h3 {
        font-size: 1.8rem;
    }

    .chart-container {
        height: 300px;
    }

    .analytics-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .analytics-actions {
        width: 100%;
        justify-content: center;
    }
}

/* System Prompt Management Styles */
.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.prompt-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.prompt-actions {
    display: flex;
    gap: 10px;
}

.prompt-templates {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.prompt-templates h5 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1rem;
}

.template-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.template-card {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-card:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
}

.template-card.selected {
    border-color: #3498db;
    background: #f0f8ff;
}

.template-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.template-description {
    color: #6c757d;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 10px;
}

.template-preview {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #495057;
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.template-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.template-actions .btn {
    padding: 4px 8px;
    font-size: 0.8rem;
    border-radius: 4px;
}

#systemPrompt {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 200px;
}

.prompt-status {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.prompt-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.prompt-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.prompt-status.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.prompt-test-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.prompt-test-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.prompt-test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.prompt-test-header h3 {
    margin: 0;
    color: #2c3e50;
}

.prompt-test-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.prompt-test-close:hover {
    background: #f8f9fa;
    color: #2c3e50;
}

.prompt-test-form {
    margin-bottom: 20px;
}

.prompt-test-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.prompt-test-response {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    min-height: 100px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.prompt-test-response.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
}

.prompt-test-response.error {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* Responsive adjustments for prompt management */
@media (max-width: 768px) {
    .prompt-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .prompt-actions {
        width: 100%;
        justify-content: center;
    }

    .template-list {
        grid-template-columns: 1fr;
    }

    .prompt-test-content {
        margin: 20px;
        width: calc(100% - 40px);
        padding: 20px;
    }
}

/* Lead Scoring Management Styles */
.scoring-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.scoring-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.8rem;
}

.scoring-actions {
    display: flex;
    gap: 15px;
}

.scoring-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.scoring-section {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.scoring-section h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.3rem;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.rule-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s ease;
}

.rule-card:hover {
    border-color: #3498db;
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.15);
}

.rule-card.active {
    border-color: #27ae60;
    background: #f0f8f0;
}

.rule-card.inactive {
    border-color: #95a5a6;
    background: #f5f5f5;
    opacity: 0.7;
}

.rule-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.rule-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
    margin: 0;
}

.rule-type {
    background: #3498db;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.rule-type.keyword {
    background: #e74c3c;
}

.rule-type.field_value {
    background: #f39c12;
}

.rule-type.conversation_length {
    background: #9b59b6;
}

.rule-type.response_time {
    background: #1abc9c;
}

.rule-details {
    margin-bottom: 15px;
}

.rule-weight {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.rule-weight label {
    font-weight: 500;
    color: #34495e;
}

.rule-weight .weight-value {
    background: #ecf0f1;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    color: #2c3e50;
}

.rule-config {
    background: white;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 0.9rem;
    color: #555;
    max-height: 100px;
    overflow-y: auto;
}

.rule-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.rule-actions .btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
}

.scoring-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.scoring-stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.scoring-stat-card h4 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
}

.scoring-stat-card p {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.scoring-templates {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.template-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-card:hover {
    border-color: #3498db;
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.15);
}

.template-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.template-category {
    background: #95a5a6;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 10px;
    display: inline-block;
}

.template-description {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 15px;
}

.template-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.template-actions .btn {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.rule-config-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.rule-config-section h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1rem;
}

.config-field {
    margin-bottom: 15px;
}

.config-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #34495e;
    font-size: 0.9rem;
}

.config-field input,
.config-field select,
.config-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.config-field textarea {
    resize: vertical;
    min-height: 80px;
}

.config-field small {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 0.8rem;
}

.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.keyword-tag {
    background: #3498db;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.keyword-tag .remove {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
}

.keyword-tag .remove:hover {
    opacity: 1;
}

.score-history-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
}

.score-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.score-change {
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.score-change.positive {
    background: #d4edda;
    color: #155724;
}

.score-change.negative {
    background: #f8d7da;
    color: #721c24;
}

.score-change.neutral {
    background: #e2e3e5;
    color: #383d41;
}

.score-details {
    font-size: 0.85rem;
    color: #6c757d;
}

/* Responsive adjustments for scoring */
@media (max-width: 768px) {
    .scoring-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .scoring-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .rules-grid,
    .template-grid {
        grid-template-columns: 1fr;
    }

    .scoring-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Validation and Notification Styles */
.validation-errors {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
}

.validation-error {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 8px;
    background: #fff;
    border-radius: 4px;
    border-left: 4px solid #f39c12;
}

.validation-error:last-child {
    margin-bottom: 0;
}

.error-icon {
    font-size: 16px;
    color: #f39c12;
}

.error-message {
    flex: 1;
    color: #856404;
    font-weight: 500;
}

.error-field {
    font-size: 12px;
    color: #6c757d;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    min-width: 300px;
    max-width: 500px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    animation: slideIn 0.3s ease-out;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
}

.notification-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.notification-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.notification-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.notification-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.notification-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.notification-message {
    flex: 1;
    font-weight: 500;
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: opacity 0.2s;
}

.notification-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Real-time validation feedback */
.form-group.validating {
    position: relative;
}

.form-group.validating::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translateY(-50%);
}

@keyframes spin {
    0% {
        transform: translateY(-50%) rotate(0deg);
    }

    100% {
        transform: translateY(-50%) rotate(360deg);
    }
}

.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-group.has-success input,
.form-group.has-success select,
.form-group.has-success textarea {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Configuration status indicators */
.config-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.config-status.loaded {
    background: #d4edda;
    color: #155724;
}

.config-status.reloading {
    background: #fff3cd;
    color: #856404;
}

.config-status.error {
    background: #f8d7da;
    color: #721c24;
}

/* Mobile responsive for notifications */
@media (max-width: 768px) {
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
    }

    .validation-errors {
        padding: 10px;
    }

    .validation-error {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}