/**
 * Conformance Checking Tool - Dark Theme Styling
 * Matches BPRboard Catppuccin color palette
 */

/* Main Container */
.conformance-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
}

/* Header */
.conformance-header {
    margin-bottom: 30px;
}

.conformance-header h3 {
    color: var(--text-primary);
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.conformance-info {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Setup Section */
.conformance-setup {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.setup-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 20px;
    
}

.setup-card.full-width {
    grid-column: 1 / -1;
}

.setup-card h4 {
    color: var(--accent-primary);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.setup-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Algorithm Selection */
.discovery-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.algorithm-select {
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--text-muted);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.algorithm-select:hover {
    border-color: var(--accent-primary);
    background: var(--bg-card);
}

.algorithm-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.1);
}

.algorithm-params {
    background: var(--bg-primary);
    padding: 15px;
    border-radius: 8px;
}

.param-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.param-item label {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.param-item input[type="number"] {
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--text-muted);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
}

.param-item input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.param-item small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Control Buttons */
.control-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.control-btn.primary {
    background: var(--accent-primary);
    color: var(--on-accent);
    border: 1px solid var(--accent-primary);
}

.control-btn.primary:hover {
    opacity: 0.9;
    
}

.control-btn.secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--text-muted);
}

.control-btn.secondary:hover {
    background: rgba(49, 50, 68, 1);
    border-color: var(--accent-primary);
}

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

/* Results Section */
.results-section {
    margin-top: 30px;
}

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

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 25px;
    
}

.result-card h4 {
    color: var(--accent-primary);
    font-size: 1.2rem;
    margin-bottom: 20px;
}

/* Fitness Score Circle */
.fitness-score {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--success);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: relative;
}

.score-circle .score-value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--on-accent);
}

.score-circle .score-label {
    font-size: 1.5rem;
    color: var(--on-accent);
    margin-left: 5px;
}

/* Fitness Details */
.fitness-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: 6px;
}

.detail-item span:first-child {
    color: var(--text-muted);
}

.detail-item span:last-child {
    color: var(--text-primary);
    font-weight: 600;
}

/* Compliance Table */
.compliance-table {
    width: 100%;
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
}

.compliance-table table {
    width: 100%;
    border-collapse: collapse;
}

.compliance-table thead {
    background: var(--bg-card);
}

.compliance-table th {
    padding: 12px;
    text-align: left;
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.compliance-table td {
    padding: 12px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.compliance-table tr:hover {
    background: rgba(49, 50, 68, 0.3);
}

/* Compliance Bar */
.compliance-bar {
    position: relative;
    width: 100%;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
}

.compliance-fill {
    height: 100%;
    background: var(--success);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.compliance-bar span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--on-accent);
    font-weight: 600;
    font-size: 0.85rem;
    
}

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.pass {
    background: rgba(166, 227, 161, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.status-badge.partial {
    background: rgba(249, 226, 175, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.status-badge.fail {
    background: rgba(243, 139, 168, 0.2);
    color: var(--error);
    border: 1px solid var(--error);
}

.status-badge.conformant {
    background: rgba(166, 227, 161, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.status-badge.violating {
    background: rgba(243, 139, 168, 0.2);
    color: var(--error);
    border: 1px solid var(--error);
}

/* Conformance Badge */
.conformance-badge {
    display: inline-block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-weight: bold;
}

.conformance-badge.conformant {
    background: rgba(166, 227, 161, 0.2);
    color: var(--success);
}

.conformance-badge.violating {
    background: rgba(243, 139, 168, 0.2);
    color: var(--error);
}

/* Trace Results */
.trace-results {
    margin-top: 20px;
}

.trace-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: center;
}

.trace-filters label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.trace-filters input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.trace-filters select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--text-muted);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
}

.violation-details {
    font-size: 0.85rem;
}

.violation-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 5px;
    font-size: 0.8rem;
}

.violation-tag.missing {
    background: rgba(243, 139, 168, 0.2);
    color: var(--error);
}

.violation-tag.unexpected {
    background: rgba(249, 226, 175, 0.2);
    color: var(--warning);
}

.violation-tag.wrong-order {
    background: rgba(245, 224, 220, 0.2);
    color: #f5e0dc;
}

.view-details-btn {
    padding: 6px 12px;
    background: rgba(137, 180, 250, 0.2);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.view-details-btn:hover {
    background: rgba(137, 180, 250, 0.3);
}

/* Violations Section */
.violations-section {
    margin-top: 30px;
}

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

.violation-item {
    background: var(--bg-card);
    border-left: 4px solid var(--error);
    border-radius: 8px;
    padding: 15px;
}

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

.violation-type {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.violation-type.missing {
    background: rgba(243, 139, 168, 0.2);
    color: var(--error);
}

.violation-type.unexpected {
    background: rgba(249, 226, 175, 0.2);
    color: var(--warning);
}

.violation-type.wrong-order {
    background: rgba(245, 224, 220, 0.2);
    color: #f5e0dc;
}

.violation-frequency {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.violation-description {
    color: var(--text-secondary);
    margin: 10px 0;
    font-size: 0.95rem;
}

.violation-impact {
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Violations Chart */
.violations-chart {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 8px;
}

#violationsCanvas {
    width: 100%;
    max-width: 100%;
}

/* Recommendations */
.recommendations-section {
    margin-top: 30px;
}

.recommendations-grid {
    display: grid;
    gap: 15px;
}

.recommendation-item {
    display: flex;
    gap: 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 20px;
}

.recommendation-icon {
    font-size: 2rem;
}

.recommendation-content {
    flex: 1;
}

.recommendation-content h5 {
    color: var(--accent-primary);
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.recommendation-content p {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.recommendation-action {
    color: var(--success);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(17, 17, 27, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(137, 180, 250, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Modal */
.trace-details-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(17, 17, 27, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: rgba(30, 30, 46, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--accent-primary);
    font-size: 1.4rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    transition: all 0.3s;
}

.modal-close:hover {
    background: rgba(243, 139, 168, 0.2);
    color: var(--error);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.modal-body h4 {
    color: var(--accent-primary);
    margin: 20px 0 10px 0;
}

.modal-body p {
    color: var(--text-secondary);
}

.modal-body ul {
    list-style: none;
    padding: 0;
}

.modal-body ul li {
    padding: 10px;
    background: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* Export Button */
.export-btn {
    background: rgba(166, 227, 161, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s;
}

.export-btn:hover {
    background: rgba(166, 227, 161, 0.3);
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 6px;
    z-index: 10001;
    
    animation: slideIn 0.3s ease;
}

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

.notification-success {
    background: rgba(166, 227, 161, 0.9);
    color: var(--on-accent);
}

.notification-error {
    background: rgba(243, 139, 168, 0.9);
    color: var(--on-accent);
}

.notification-info {
    background: rgba(137, 180, 250, 0.9);
    color: var(--on-accent);
}

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

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

    .trace-filters {
        flex-direction: column;
        align-items: flex-start;
    }

    .score-circle {
        width: 120px;
        height: 120px;
    }

    .score-circle .score-value {
        font-size: 2.5rem;
    }
}

/* Save button styling */
.conformance-save-btn {
    background: var(--accent-green) !important;
    color: var(--text-primary) !important;
}
