/**
 * CPRMV Metadata Display Styles
 * Operaton DMN Plugin - CPRMV Enhancement
 *
 * @package OperatonDMN
 * @since 1.1.0
 */

/* ===========================
   CPRMV Info Button
   =========================== */

.cprmv-info-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    margin: 10px 0;
    background: #f0f7ff;
    border: 2px solid #3b82f6;
    border-radius: 6px;
    color: #1e40af;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.cprmv-info-button:hover {
    background: #dbeafe;
    border-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.1);
}

.cprmv-info-button:active {
    transform: translateY(0);
}

.cprmv-icon {
    font-size: 18px;
}

/* ===========================
   Modal Overlay & Container
   =========================== */

.cprmv-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cprmv-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
                0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: cprmv-modal-enter 0.2s ease-out;
}

@keyframes cprmv-modal-enter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ===========================
   Modal Header
   =========================== */

.cprmv-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 2px solid #e5e7eb;
    background: linear-gradient(to right, #f9fafb, #ffffff);
}

.cprmv-modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}

.cprmv-modal-close {
    background: transparent;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.cprmv-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

/* ===========================
   Modal Body
   =========================== */

.cprmv-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.cprmv-modal-body::-webkit-scrollbar {
    width: 8px;
}

.cprmv-modal-body::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

.cprmv-modal-body::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 4px;
}

.cprmv-modal-body::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* ===========================
   Modal Footer
   =========================== */

.cprmv-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    background: #f9fafb;
}

.cprmv-modal-close-btn {
    padding: 10px 24px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cprmv-modal-close-btn:hover {
    background: #2563eb;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

/* ===========================
   Content Sections
   =========================== */

.cprmv-metadata-content {
    color: #374151;
    line-height: 1.6;
}

.cprmv-section {
    margin-bottom: 28px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

.cprmv-section:last-child {
    margin-bottom: 0;
}

.cprmv-section h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.cprmv-field {
    margin-bottom: 12px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.cprmv-field:last-child {
    margin-bottom: 0;
}

.cprmv-field strong {
    color: #1f2937;
    font-weight: 600;
    display: inline-block;
    margin-right: 8px;
}

/* ===========================
   Legal References
   =========================== */

.cprmv-legal-ref {
    background: #eff6ff;
    border-color: #3b82f6;
}

.cprmv-law-id {
    font-family: 'Monaco', 'Courier New', monospace;
    font-weight: 700;
    color: #1e40af;
    font-size: 15px;
}

.cprmv-version {
    color: #6b7280;
    font-size: 13px;
    font-style: italic;
}

.cprmv-extends {
    display: inline-block;
    padding: 4px 8px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    color: #374151;
    word-break: break-all;
}

/* ===========================
   Rules Accordion
   =========================== */

.cprmv-rules-accordion {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cprmv-rule-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.cprmv-rule-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.cprmv-rule-header {
    padding: 14px 16px;
    background: #f9fafb;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease;
    user-select: none;
}

.cprmv-rule-header:hover {
    background: #f3f4f6;
}

.cprmv-rule-toggle {
    color: #3b82f6;
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.2s ease;
}

.cprmv-rule-header strong {
    color: #111827;
    font-size: 15px;
}

.cprmv-rule-period {
    color: #6b7280;
    font-size: 13px;
    margin-left: auto;
}

.cprmv-rule-details {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
}

.cprmv-rule-details .cprmv-field {
    margin-bottom: 10px;
}

/* ===========================
   Confidence Indicators
   =========================== */

.cprmv-confidence-high {
    border-left: 4px solid #10b981;
    background: #ecfdf5;
}

.cprmv-confidence-medium {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}

.cprmv-confidence-low {
    border-left: 4px solid #ef4444;
    background: #fef2f2;
}

/* ===========================
   Notes and Messages
   =========================== */

.cprmv-note {
    background: #fef3c7;
    border-color: #f59e0b;
    border-left-width: 4px;
}

.cprmv-note em {
    color: #92400e;
    font-style: italic;
}

.cprmv-notice {
    padding: 20px;
    background: #f0f9ff;
    border: 2px solid #3b82f6;
    border-radius: 8px;
    color: #1e40af;
}

.cprmv-notice p {
    margin: 8px 0;
}

.cprmv-loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
    font-size: 16px;
}

.cprmv-error {
    padding: 20px;
    background: #fef2f2;
    border: 2px solid #ef4444;
    border-radius: 8px;
    color: #991b1b;
}

.cprmv-error-detail {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    padding: 12px;
    background: white;
    border-radius: 4px;
    margin-top: 12px;
}

/* ===========================
   Matched Rule Banner
   =========================== */

.cprmv-matched-rule-banner {
    margin: 20px 0;
    padding: 16px;
    background: linear-gradient(to right, #ecfdf5, #d1fae5);
    border: 2px solid #10b981;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
}

.cprmv-banner-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 16px;
    color: #065f46;
}

.cprmv-banner-header .cprmv-icon {
    font-size: 20px;
}

.cprmv-banner-content .cprmv-legal-ref {
    margin-bottom: 8px;
}

.cprmv-banner-content .cprmv-note {
    background: rgba(255, 255, 255, 0.7);
}

/* ===========================
   Decision Table Info
   =========================== */

.cprmv-table-info {
    border-left-color: #8b5cf6;
}

.cprmv-table-info .cprmv-field {
    background: #faf5ff;
    border-color: #e9d5ff;
}

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 768px) {
    .cprmv-modal {
        max-width: 95%;
        max-height: 95vh;
    }

    .cprmv-modal-header {
        padding: 16px;
    }

    .cprmv-modal-header h2 {
        font-size: 18px;
    }

    .cprmv-modal-body {
        padding: 16px;
    }

    .cprmv-section {
        padding: 16px;
    }

    .cprmv-rule-header {
        flex-wrap: wrap;
    }

    .cprmv-rule-period {
        margin-left: 0;
        width: 100%;
        margin-top: 4px;
    }

    .cprmv-info-button {
        width: 100%;
        justify-content: center;
    }
}

/* ===========================
   Print Styles
   =========================== */

@media print {
    .cprmv-modal-overlay {
        position: relative;
        background: white;
    }

    .cprmv-modal {
        max-width: 100%;
        max-height: none;
        box-shadow: none;
    }

    .cprmv-modal-close,
    .cprmv-modal-footer {
        display: none;
    }

    .cprmv-rule-details {
        display: block !important;
    }

    .cprmv-rule-toggle {
        display: none;
    }
}

/* ===========================
   Accessibility
   =========================== */

.cprmv-info-button:focus,
.cprmv-modal-close:focus,
.cprmv-modal-close-btn:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

.cprmv-rule-header:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}
