/* ============================================================================
   LYNCLEGAL PRODUCT STYLESHEET
   ============================================================================
   
   Purpose: Product-specific overrides for the LyncLegal brand variant.
   
   This stylesheet extends the base Lynctera design system with LyncLegal's
   unique visual identity while maintaining token-based theming.
   
   Loaded via: BrandConfiguration.custom_css_url = '/css/lynclegal.css'
   
   Design System: See docs/DESIGN_SYSTEM.md for token reference
   ============================================================================ */

/* ============================================================================
   PRODUCT TOKENS
   ============================================================================
   LyncLegal uses a distinctive red/orange gradient for CTAs to differentiate
   from the main portal's blue brand. These tokens are product-specific.
   ============================================================================ */

:root {
    /* LyncLegal CTA Gradient - used for primary action buttons */
    --lynclegal-cta-start: #dc2626;     /* red-600 */
    --lynclegal-cta-end: #ea580c;       /* orange-600 */
    --lynclegal-cta-start-hover: #b91c1c; /* red-700 */
    --lynclegal-cta-end-hover: #c2410c;   /* orange-700 */
    
    /* RGB variants for alpha compositing */
    --lynclegal-cta-start-rgb: 220 38 38;
    --lynclegal-cta-end-rgb: 234 88 12;
    
    /* LyncLegal accent gradient - for panel headers, badges */
    --lynclegal-accent-start: #059669;  /* emerald-600 */
    --lynclegal-accent-end: #0d9488;    /* teal-600 */
    
    /* Panel header background */
    --lynclegal-panel-header-rgb: 30 41 59; /* slate-800 */
}

/* ============================================================================
   COMPONENT OVERRIDES
   ============================================================================ */

/* Primary CTA Button - LyncLegal uses red/orange gradient */
.lynclegal-btn-cta {
    background: linear-gradient(to right, var(--lynclegal-cta-start), var(--lynclegal-cta-end));
    color: rgb(var(--text-inverse-rgb));
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    transition: all 150ms ease;
    min-height: 44px; /* Touch target */
}

.lynclegal-btn-cta:hover:not(:disabled) {
    background: linear-gradient(to right, var(--lynclegal-cta-start-hover), var(--lynclegal-cta-end-hover));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgb(var(--lynclegal-cta-start-rgb) / 0.3);
}

.lynclegal-btn-cta:active:not(:disabled) {
    transform: scale(0.98);
}

.lynclegal-btn-cta:focus-visible {
    outline: 2px solid rgb(var(--focus-rgb));
    outline-offset: 2px;
}

.lynclegal-btn-cta:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Secondary CTA - emerald/teal gradient for mitigation analysis */
.lynclegal-btn-secondary {
    background: linear-gradient(to right, var(--lynclegal-accent-start), var(--lynclegal-accent-end));
    color: rgb(var(--text-inverse-rgb));
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    transition: all 150ms ease;
    min-height: 44px;
}

.lynclegal-btn-secondary:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.lynclegal-btn-secondary:focus-visible {
    outline: 2px solid rgb(var(--focus-rgb));
    outline-offset: 2px;
}

/* Panel Header - dark slate for tool panels */
.lynclegal-panel-header {
    background-color: rgb(var(--lynclegal-panel-header-rgb));
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lynclegal-panel-header-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgb(var(--text-inverse-rgb));
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Findings Panel Header - red/orange gradient */
.lynclegal-panel-header-findings {
    background: linear-gradient(to right, var(--lynclegal-cta-start), var(--lynclegal-cta-end));
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Mitigation Panel Header - emerald/teal gradient */
.lynclegal-panel-header-mitigation {
    background: linear-gradient(to right, var(--lynclegal-accent-start), var(--lynclegal-accent-end));
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* AI Summary Panel Header - purple/indigo gradient */
.lynclegal-panel-header-ai {
    background: linear-gradient(to right, #9333ea, #4f46e5); /* purple-600 to indigo-600 */
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ============================================================================
   SEVERITY BADGES
   ============================================================================ */

.lynclegal-severity-high {
    background-color: rgb(var(--error-bg-rgb));
    color: #b91c1c; /* red-700 */
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.lynclegal-severity-medium {
    background-color: rgb(var(--warning-bg-rgb));
    color: #b45309; /* amber-700 */
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.lynclegal-severity-low {
    background-color: rgb(var(--success-bg-rgb));
    color: #15803d; /* green-700 */
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* ============================================================================
   FINDING CARDS
   ============================================================================ */

.lynclegal-finding-card {
    border-radius: 0.5rem;
    overflow: hidden;
    transition: box-shadow 150ms ease;
    background-color: rgb(var(--surface-primary-rgb));
}

.lynclegal-finding-card:hover {
    box-shadow: 0 4px 12px rgb(var(--neutral-900-rgb) / 0.1);
}

.lynclegal-finding-card-high {
    border: 1px solid rgb(var(--error-rgb) / 0.3);
    background-color: rgb(var(--error-bg-rgb) / 0.5);
}

.lynclegal-finding-card-medium {
    border: 1px solid rgb(var(--warning-rgb) / 0.3);
    background-color: rgb(var(--warning-bg-rgb) / 0.5);
}

.lynclegal-finding-card-low {
    border: 1px solid rgb(var(--success-rgb) / 0.3);
    background-color: rgb(var(--success-bg-rgb) / 0.5);
}

/* Clause quote styling */
.lynclegal-clause-quote {
    background-color: rgb(var(--surface-primary-rgb) / 0.6);
    padding: 0.5rem 0.75rem;
    margin: 0.75rem 0;
    font-style: italic;
    font-size: 0.875rem;
    color: rgb(var(--text-secondary-rgb));
    border-left-width: 3px;
}

.lynclegal-clause-quote-high {
    border-left-color: rgb(var(--error-rgb));
}

.lynclegal-clause-quote-medium {
    border-left-color: rgb(var(--warning-rgb));
}

.lynclegal-clause-quote-low {
    border-left-color: rgb(var(--success-rgb));
}

/* ============================================================================
   DISCLAIMER BAR
   ============================================================================ */

.lynclegal-disclaimer {
    background-color: rgb(var(--warning-bg-rgb));
    border-top: 1px solid rgb(var(--warning-rgb) / 0.3);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #92400e; /* amber-800 */
    font-size: 0.75rem;
}

/* ============================================================================
   MODE TOGGLE
   ============================================================================ */

.lynclegal-mode-toggle {
    display: flex;
    align-items: center;
    background-color: rgb(var(--surface-tertiary-rgb));
    border-radius: 0.5rem;
    padding: 0.125rem;
}

.lynclegal-mode-toggle-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 150ms ease;
    color: rgb(var(--text-secondary-rgb));
}

.lynclegal-mode-toggle-btn:hover {
    color: rgb(var(--text-primary-rgb));
}

.lynclegal-mode-toggle-btn-active {
    background-color: rgb(var(--surface-primary-rgb));
    color: rgb(var(--text-primary-rgb));
    box-shadow: 0 1px 2px rgb(var(--neutral-900-rgb) / 0.1);
}

/* ============================================================================
   UTILITY BUTTONS (icon-only)
   ============================================================================ */

.lynclegal-icon-btn {
    padding: 0.5rem;
    background-color: rgb(var(--surface-tertiary-rgb));
    color: rgb(var(--text-secondary-rgb));
    border-radius: 0.5rem;
    transition: all 150ms ease;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lynclegal-icon-btn:hover:not(:disabled) {
    background-color: rgb(var(--neutral-200-rgb));
}

.lynclegal-icon-btn:focus-visible {
    outline: 2px solid rgb(var(--focus-rgb));
    outline-offset: 2px;
}

.lynclegal-icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Active state for toggles */
.lynclegal-icon-btn-active {
    background-color: rgb(var(--info-bg-rgb));
    color: rgb(var(--info-rgb));
}

/* ============================================================================
   KNOWLEDGE BASE INDICATOR
   ============================================================================ */

.lynclegal-kb-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #4f46e5; /* indigo-600 */
    margin-top: 0.75rem;
}

/* ============================================================================
   EMPTY STATE
   ============================================================================ */

.lynclegal-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
}

.lynclegal-empty-state-icon {
    width: 4rem;
    height: 4rem;
    background-color: rgb(var(--surface-tertiary-rgb));
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.lynclegal-empty-state-title {
    font-weight: 500;
    color: rgb(var(--text-primary-rgb));
    margin-bottom: 0.25rem;
}

.lynclegal-empty-state-description {
    font-size: 0.875rem;
    color: rgb(var(--text-secondary-rgb));
    max-width: 20rem;
}

/* ============================================================================
   LOADING STATE
   ============================================================================ */

.lynclegal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.lynclegal-loading-spinner {
    animation: spin 0.6s linear infinite;
}

/* ============================================================================
   TOAST OVERRIDES
   ============================================================================ */

.lynclegal-toast-success {
    background-color: rgb(var(--success-rgb));
    color: rgb(var(--text-inverse-rgb));
}

.lynclegal-toast-error {
    background-color: rgb(var(--error-rgb));
    color: rgb(var(--text-inverse-rgb));
}

/* ============================================================================
   DARK MODE SUPPORT
   ============================================================================
   LyncLegal inherits dark mode from the base design system.
   Product-specific tokens are adjusted for dark mode below.
   ============================================================================ */

html.dark {
    /* Panel header stays dark (already dark) */
    --lynclegal-panel-header-rgb: 15 23 42; /* slate-900 */
    
    /* Severity badges invert for dark mode */
    .lynclegal-severity-high {
        background-color: rgb(var(--error-rgb) / 0.2);
        color: #fca5a5; /* red-300 */
    }
    
    .lynclegal-severity-medium {
        background-color: rgb(var(--warning-rgb) / 0.2);
        color: #fcd34d; /* amber-300 */
    }
    
    .lynclegal-severity-low {
        background-color: rgb(var(--success-rgb) / 0.2);
        color: #86efac; /* green-300 */
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .lynclegal-btn-cta,
    .lynclegal-btn-secondary,
    .lynclegal-icon-btn {
        display: none;
    }
    
    .lynclegal-panel-header,
    .lynclegal-panel-header-findings,
    .lynclegal-panel-header-mitigation {
        background: #f1f5f9 !important;
        color: #0f172a !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .lynclegal-disclaimer {
        background: #fef3c7 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ============================================================================
   REDUCED MOTION
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .lynclegal-btn-cta,
    .lynclegal-btn-secondary,
    .lynclegal-icon-btn,
    .lynclegal-finding-card {
        transition: none;
    }
    
    .lynclegal-loading-spinner {
        animation: none;
    }
}
