/**
 * Policy Relevance System Display Styles
 * Following NeutralAiz Glass Morphism Design System
 * Updated for Group 2A Core Display Components
 */

/* =============================================================================
   POLICY CARD COMPONENTS - Glass Morphism Design
   ============================================================================= */

/* Main Policy Card Container */
.policy-relevance-card {
    background: rgba(30, 35, 45, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(100, 110, 130, 0.35);
    border-radius: 4px;
    margin-bottom: 16px;
    transition: all 250ms ease;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.policy-relevance-card:hover {
    background: rgba(35, 40, 50, 0.7);
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 4px 24px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

/* Policy Card Header */
.policy-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px;
    border-bottom: 1px solid rgba(100, 110, 130, 0.2);
    background: rgba(37, 99, 235, 0.05);
}

.policy-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.policy-relevance-score {
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 4px;
    font-size: 18px;
    font-weight: 700;
    color: rgba(96, 165, 250, 0.9);
}

.relevance-label {
    font-size: 10px;
    font-weight: 500;
    color: rgba(175, 190, 225, 0.68);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.policy-title-area {
    flex: 1;
    min-width: 0;
}

.policy-card-title {
    font-size: 16px;
    font-weight: 600;
    color: rgba(235, 240, 255, 0.92);
    margin: 0 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
    word-wrap: break-word;
}

.policy-section-info {
    font-size: 12px;
    color: rgba(175, 190, 225, 0.68);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.policy-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
}

/* =============================================================================
   CONTROL BUTTONS AND LOADING INDICATORS
   ============================================================================= */

/* Control Buttons */
.policy-control-btn {
    padding: 6px 12px;
    background: rgba(37, 99, 235, 0.15);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 4px;
    color: rgba(96, 165, 250, 0.9);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 250ms ease;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.policy-control-btn:hover {
    background: rgba(37, 99, 235, 0.25);
    border-color: rgba(37, 99, 235, 0.5);
    color: rgba(147, 197, 253, 1);
    transform: translateY(-1px);
}

.policy-control-btn.refresh {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: rgba(52, 211, 153, 0.9);
}

.policy-control-btn.refresh:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.5);
    color: rgba(110, 231, 183, 1);
}

.policy-control-btn.analyze {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: rgba(167, 139, 250, 0.9);
}

.policy-control-btn.analyze:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.5);
    color: rgba(196, 181, 253, 1);
}

.policy-control-btn.remove {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: rgba(248, 113, 113, 0.9);
}

.policy-control-btn.remove:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    color: rgba(252, 165, 165, 1);
}

/* Loading Indicators */
.policy-loading-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(45, 50, 60, 0.6);
    border: 1px solid rgba(100, 110, 130, 0.3);
    border-radius: 4px;
    color: rgba(205, 215, 245, 0.82);
    font-size: 13px;
    animation: pulse 2s ease-in-out infinite;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(37, 99, 235, 0.3);
    border-top: 2px solid rgba(37, 99, 235, 0.8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Policy Count Display */
.policy-count-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(45, 50, 60, 0.3);
    border: 1px solid rgba(100, 110, 130, 0.2);
    border-radius: 4px;
    font-size: 12px;
    color: rgba(175, 190, 225, 0.68);
    margin-right: 12px;
}

.count-number {
    font-weight: 600;
    color: rgba(96, 165, 250, 0.9);
}

/* =============================================================================
   BEHAVIOR NESTING STYLES
   ============================================================================= */

/* Triggering Behaviors Section */
.behaviors-section {
    margin-top: 16px;
    border-top: 1px solid rgba(100, 110, 130, 0.2);
    padding-top: 16px;
}

.behaviors-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(45, 50, 60, 0.3);
    border: 1px solid rgba(100, 110, 130, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: all 250ms ease;
    font-size: 14px;
    color: rgba(205, 215, 245, 0.82);
    font-weight: 500;
}

.behaviors-header:hover {
    background: rgba(45, 50, 60, 0.5);
    border-color: rgba(100, 110, 130, 0.4);
    color: rgba(235, 240, 255, 0.92);
}

.behaviors-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.behaviors-icon {
    color: rgba(234, 179, 8, 0.7);
    font-size: 16px;
}

.behaviors-count {
    padding: 2px 8px;
    background: rgba(234, 179, 8, 0.2);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(251, 191, 36, 0.9);
}

.behaviors-toggle {
    transition: transform 250ms ease;
    font-size: 12px;
    color: rgba(175, 190, 225, 0.68);
}

.behaviors-toggle.expanded {
    transform: rotate(180deg);
}

/* Behavior List Container */
.behaviors-list {
    margin-top: 12px;
    padding: 0;
    overflow: hidden;
    transition: all 250ms ease;
}

.behaviors-list.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.behaviors-list.expanded {
    max-height: 1000px;
    opacity: 1;
}

/* Individual Behavior Items */
.behavior-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    margin-bottom: 8px;
    background: rgba(45, 50, 60, 0.2);
    border: 1px solid rgba(100, 110, 130, 0.15);
    border-left: 3px solid rgba(234, 179, 8, 0.4);
    border-radius: 4px;
    transition: all 250ms ease;
}

.behavior-item:hover {
    background: rgba(45, 50, 60, 0.35);
    border-color: rgba(100, 110, 130, 0.25);
    border-left-color: rgba(234, 179, 8, 0.6);
}

.behavior-number {
    min-width: 28px;
    height: 28px;
    background: rgba(234, 179, 8, 0.2);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: rgba(251, 191, 36, 0.9);
    margin-top: 2px;
}

.behavior-content {
    flex: 1;
    min-width: 0;
}

.behavior-text {
    font-size: 14px;
    color: rgba(235, 240, 255, 0.92);
    line-height: 1.5;
    margin-bottom: 8px;
    word-wrap: break-word;
}

.behavior-reason {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 13px;
    color: rgba(175, 190, 225, 0.68);
    font-style: italic;
    margin-bottom: 8px;
    line-height: 1.4;
}

.behavior-reason i {
    font-size: 12px;
    margin-top: 2px;
    opacity: 0.6;
    min-width: 12px;
}

.behavior-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 11px;
    color: rgba(175, 190, 225, 0.5);
}

.behavior-metadata span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.behavior-metadata i {
    font-size: 10px;
    opacity: 0.6;
}

/* =============================================================================
   RESPONSIVE DESIGN RULES
   ============================================================================= */

/* Tablet Adjustments */
@media (max-width: 1024px) {
    .policy-card-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .policy-header-left {
        width: 100%;
    }

    .policy-card-actions {
        margin-left: 0;
        align-self: flex-end;
    }

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

    .behavior-number {
        align-self: flex-start;
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .policy-relevance-card {
        margin-bottom: 12px;
    }

    .policy-card-header,
    .behavior-item {
        padding: 12px;
    }

    .policy-card-title {
        font-size: 14px;
    }

    .policy-section-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .policy-card-actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    .policy-control-btn {
        padding: 4px 8px;
        font-size: 11px;
    }

    .behavior-metadata {
        flex-direction: column;
        gap: 6px;
    }

    .behaviors-header {
        padding: 8px;
        font-size: 13px;
    }
}

/* Small Mobile Adjustments */
@media (max-width: 480px) {
    .policy-header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .policy-relevance-score {
        align-self: flex-start;
        min-width: 50px;
        padding: 6px 8px;
        font-size: 16px;
    }

    .policy-card-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* =============================================================================
   ANIMATION AND TRANSITION STYLES
   ============================================================================= */

/* Card Entry Animation */
@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.policy-relevance-card.animate-in {
    animation: cardSlideIn 250ms ease forwards;
}

/* Behavior Expand Animation */
@keyframes behaviorExpand {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
}

.behaviors-list.expanding {
    animation: behaviorExpand 250ms ease forwards;
}

/* Button Press Animation */
.policy-control-btn:active {
    transform: translateY(1px);
    transition: transform 100ms ease;
}

/* Loading State Transitions */
.policy-card-content.loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 250ms ease;
}

/* =============================================================================
   EMPTY STATE AND ERROR STYLES
   ============================================================================= */

.no-policies-state {
    text-align: center;
    padding: 60px 20px;
    color: rgba(175, 190, 225, 0.68);
    background: rgba(30, 35, 45, 0.3);
    border: 1px solid rgba(100, 110, 130, 0.2);
    border-radius: 4px;
    margin: 16px 0;
}

.no-policies-state i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
    color: rgba(37, 99, 235, 0.5);
}

.no-policies-state h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: rgba(205, 215, 245, 0.82);
    font-weight: 500;
}

.no-policies-state p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Error State */
.policy-error-state {
    padding: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    color: rgba(248, 113, 113, 0.9);
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.policy-error-state i {
    font-size: 20px;
    opacity: 0.8;
}

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */

.policy-hidden {
    display: none !important;
}

.policy-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.policy-highlighted {
    background: rgba(37, 99, 235, 0.1) !important;
    border-color: rgba(37, 99, 235, 0.5) !important;
}

.policy-card-collapsible {
    overflow: hidden;
    transition: max-height 250ms ease;
}

/* Focus States for Accessibility */
.policy-control-btn:focus,
.behaviors-header:focus {
    outline: 2px solid rgba(37, 99, 235, 0.6);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .policy-relevance-card {
        border-color: rgba(255, 255, 255, 0.8);
    }

    .policy-card-title {
        color: rgba(255, 255, 255, 1);
    }

    .policy-control-btn {
        border-color: rgba(255, 255, 255, 0.6);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .policy-relevance-card,
    .policy-control-btn,
    .behaviors-list,
    .behavior-item {
        transition: none;
    }

    .loading-spinner {
        animation: none;
    }

    .policy-loading-indicator {
        animation: none;
    }
}