/* ============================================================
   CLIEAIR Design System
   Civil Liberties Investigative Enforcement by AI Review
   Constitutional rights enforcement platform design tokens,
   components, animations, and utility classes.
   ============================================================ */

/* ----------------------------------------------------------
   1. DESIGN TOKENS (CSS Custom Properties)
   ---------------------------------------------------------- */
:root {
    /* Primary palette */
    --clieair-navy: #0d1b2a;
    --clieair-navy-light: #1b2838;
    --clieair-gold: #c9a227;
    --clieair-gold-light: #e5d4a1;

    /* Semantic colors */
    --clieair-green: #22c55e;
    --clieair-red: #ef4444;
    --clieair-yellow: #eab308;

    /* Surfaces */
    --clieair-cream: #faf8f5;
    --clieair-paper: #f5f2ed;

    /* Typography */
    --clieair-font-serif: 'Cormorant Garamond', Georgia, serif;
    --clieair-font-sans: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing scale */
    --clieair-space-xs: 0.25rem;
    --clieair-space-sm: 0.5rem;
    --clieair-space-md: 1rem;
    --clieair-space-lg: 1.5rem;
    --clieair-space-xl: 2rem;
    --clieair-space-2xl: 3rem;
    --clieair-space-3xl: 4rem;

    /* Border radius */
    --clieair-radius-sm: 0.375rem;
    --clieair-radius-md: 0.75rem;
    --clieair-radius-lg: 1rem;
    --clieair-radius-xl: 1.5rem;
    --clieair-radius-full: 9999px;

    /* Shadows */
    --clieair-shadow-sm: 0 1px 3px rgba(13, 27, 42, 0.08);
    --clieair-shadow-md: 0 4px 12px rgba(13, 27, 42, 0.12);
    --clieair-shadow-lg: 0 8px 30px rgba(13, 27, 42, 0.16);
    --clieair-shadow-gold: 0 0 20px rgba(201, 162, 39, 0.3);
    --clieair-shadow-glow: 0 0 40px rgba(201, 162, 39, 0.15);

    /* Transitions */
    --clieair-transition-fast: 150ms ease;
    --clieair-transition-base: 300ms ease;
    --clieair-transition-slow: 500ms ease;

    /* Z-index layers */
    --clieair-z-ticker: 40;
    --clieair-z-nav: 50;
    --clieair-z-dropdown: 60;
    --clieair-z-modal: 70;
    --clieair-z-toast: 80;
}


/* ----------------------------------------------------------
   2. ANIMATIONS (@keyframes)
   ---------------------------------------------------------- */

/* Gold glow pulse for beacon cards */
@keyframes pulse-beacon {
    0%, 100% {
        box-shadow: 0 0 5px rgba(201, 162, 39, 0.2),
                    0 0 15px rgba(201, 162, 39, 0.1);
    }
    50% {
        box-shadow: 0 0 15px rgba(201, 162, 39, 0.4),
                    0 0 40px rgba(201, 162, 39, 0.2);
    }
}

/* Horizontal ticker scroll */
@keyframes scroll-ticker {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Entrance animation: fade up */
@keyframes fade-up {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Red/green compliance flash */
@keyframes compliance-flash {
    0%, 100% {
        opacity: 1;
    }
    25% {
        opacity: 0.6;
        background-color: var(--clieair-red);
    }
    50% {
        opacity: 1;
        background-color: var(--clieair-green);
    }
    75% {
        opacity: 0.6;
    }
}

/* Subtle border rotation for glow effect */
@keyframes border-glow-rotate {
    0% {
        border-color: rgba(201, 162, 39, 0.3);
    }
    33% {
        border-color: rgba(201, 162, 39, 0.6);
    }
    66% {
        border-color: rgba(201, 162, 39, 0.4);
    }
    100% {
        border-color: rgba(201, 162, 39, 0.3);
    }
}

/* Retribution meter fill */
@keyframes meter-fill {
    0% {
        width: 0%;
    }
}

/* Spin for loading states */
@keyframes clieair-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Dot pulse for status indicators */
@keyframes dot-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}


/* ----------------------------------------------------------
   3. COMPONENT CLASSES
   ---------------------------------------------------------- */

/* --- Beacon Card ---
   Glowing border card used for government action items */
.beacon-card {
    background: white;
    border: 1px solid rgba(201, 162, 39, 0.2);
    border-radius: var(--clieair-radius-lg);
    padding: var(--clieair-space-lg);
    transition: all var(--clieair-transition-base);
    animation: pulse-beacon 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.beacon-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--clieair-gold), var(--clieair-gold-light), var(--clieair-gold));
    opacity: 0;
    transition: opacity var(--clieair-transition-base);
}

.beacon-card:hover {
    border-color: var(--clieair-gold);
    box-shadow: var(--clieair-shadow-gold);
    transform: translateY(-2px);
}

.beacon-card:hover::before {
    opacity: 1;
}

/* Beacon card status variants */
.beacon-card.status-green {
    border-left: 4px solid var(--clieair-green);
}

.beacon-card.status-red {
    border-left: 4px solid var(--clieair-red);
}

.beacon-card.status-yellow {
    border-left: 4px solid var(--clieair-yellow);
}


/* --- Compliance Badge ---
   Red/green/yellow status badges */
.compliance-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--clieair-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.5;
}

.compliance-badge::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: dot-pulse 2s ease-in-out infinite;
}

.compliance-badge.badge-green {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}

.compliance-badge.badge-green::before {
    background: var(--clieair-green);
}

.compliance-badge.badge-red {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.compliance-badge.badge-red::before {
    background: var(--clieair-red);
}

.compliance-badge.badge-yellow {
    background: rgba(234, 179, 8, 0.12);
    color: #a16207;
}

.compliance-badge.badge-yellow::before {
    background: var(--clieair-yellow);
}


/* --- Retribution Meter ---
   Animated horizontal bar showing dollar ranges */
.retribution-meter {
    position: relative;
    width: 100%;
    height: 2rem;
    background: var(--clieair-paper);
    border-radius: var(--clieair-radius-full);
    overflow: hidden;
    border: 1px solid rgba(13, 27, 42, 0.1);
}

.retribution-meter__fill {
    height: 100%;
    border-radius: var(--clieair-radius-full);
    background: linear-gradient(90deg, var(--clieair-gold), #d4c17a, var(--clieair-gold-light));
    transition: width 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--clieair-navy);
    animation: meter-fill 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.retribution-meter__label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--clieair-navy);
    z-index: 1;
    white-space: nowrap;
}

/* Severity variants */
.retribution-meter.severity-minor .retribution-meter__fill {
    background: linear-gradient(90deg, var(--clieair-green), #4ade80);
}

.retribution-meter.severity-moderate .retribution-meter__fill {
    background: linear-gradient(90deg, var(--clieair-yellow), #facc15);
}

.retribution-meter.severity-severe .retribution-meter__fill {
    background: linear-gradient(90deg, #f97316, #fb923c);
}

.retribution-meter.severity-egregious .retribution-meter__fill {
    background: linear-gradient(90deg, var(--clieair-red), #f87171);
}


/* --- Ticker Strip ---
   Horizontally scrolling news-style ticker */
.ticker-strip {
    width: 100%;
    overflow: hidden;
    background: var(--clieair-navy);
    color: white;
    padding: 0.5rem 0;
    position: relative;
    z-index: var(--clieair-z-ticker);
}

.ticker-strip__track {
    display: flex;
    width: max-content;
    animation: scroll-ticker 60s linear infinite;
}

.ticker-strip__track:hover {
    animation-play-state: paused;
}

.ticker-strip__item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1.5rem;
    white-space: nowrap;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: color var(--clieair-transition-fast);
}

.ticker-strip__item:hover {
    color: var(--clieair-gold-light);
}

.ticker-strip__dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ticker-strip__dot.dot-green {
    background: var(--clieair-green);
    box-shadow: 0 0 6px var(--clieair-green);
}

.ticker-strip__dot.dot-red {
    background: var(--clieair-red);
    box-shadow: 0 0 6px var(--clieair-red);
}

.ticker-strip__dot.dot-yellow {
    background: var(--clieair-yellow);
    box-shadow: 0 0 6px var(--clieair-yellow);
}

.ticker-strip__separator {
    color: var(--clieair-gold);
    opacity: 0.4;
    padding: 0 0.5rem;
}

.ticker-strip__score {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ticker-strip__score.score-positive {
    color: var(--clieair-green);
}

.ticker-strip__score.score-negative {
    color: var(--clieair-red);
}


/* --- Glass Panel ---
   Backdrop-blur frosted glass panel */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--clieair-radius-lg);
    box-shadow: var(--clieair-shadow-md);
}

.glass-panel--dark {
    background: rgba(13, 27, 42, 0.75);
    border: 1px solid rgba(201, 162, 39, 0.15);
    color: white;
}


/* --- Impact Score Bar ---
   Inline horizontal bar for showing -1 to +1 scores */
.impact-score-bar {
    position: relative;
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: var(--clieair-radius-full);
    overflow: visible;
}

.impact-score-bar__center {
    position: absolute;
    top: -2px;
    left: 50%;
    width: 2px;
    height: 10px;
    background: var(--clieair-navy);
    opacity: 0.3;
}

.impact-score-bar__fill {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: var(--clieair-radius-full);
    transition: all var(--clieair-transition-slow);
}

.impact-score-bar__fill.fill-positive {
    left: 50%;
    background: linear-gradient(90deg, #86efac, var(--clieair-green));
}

.impact-score-bar__fill.fill-negative {
    right: 50%;
    background: linear-gradient(270deg, #fca5a5, var(--clieair-red));
}


/* --- Amendment Tag ---
   Small pill tags for listing affected amendments */
.amendment-tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: rgba(13, 27, 42, 0.06);
    color: var(--clieair-navy);
    border-radius: var(--clieair-radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid rgba(13, 27, 42, 0.1);
    transition: all var(--clieair-transition-fast);
}

.amendment-tag:hover {
    background: rgba(201, 162, 39, 0.15);
    border-color: var(--clieair-gold);
}


/* --- Toast Notification ---
   Popup notifications for CLIEAIR.notify */
.clieair-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: var(--clieair-z-toast);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.clieair-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--clieair-radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--clieair-shadow-lg);
    animation: fade-up 0.3s ease forwards;
    max-width: 24rem;
    border-left: 4px solid;
}

.clieair-toast--info {
    background: white;
    color: var(--clieair-navy);
    border-left-color: #3b82f6;
}

.clieair-toast--success {
    background: white;
    color: var(--clieair-navy);
    border-left-color: var(--clieair-green);
}

.clieair-toast--warning {
    background: white;
    color: var(--clieair-navy);
    border-left-color: var(--clieair-yellow);
}

.clieair-toast--error {
    background: white;
    color: var(--clieair-navy);
    border-left-color: var(--clieair-red);
}

.clieair-toast__close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    font-size: 1.125rem;
    line-height: 1;
    padding: 0;
}

.clieair-toast__close:hover {
    opacity: 1;
}

@keyframes toast-exit {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.clieair-toast--exiting {
    animation: toast-exit 0.3s ease forwards;
}


/* --- Compliance Gauge (Circular) ---
   Used in sidebar for overall health score */
.compliance-gauge {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto;
}

.compliance-gauge__svg {
    transform: rotate(-90deg);
}

.compliance-gauge__bg {
    fill: none;
    stroke: var(--clieair-paper);
    stroke-width: 10;
}

.compliance-gauge__fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.compliance-gauge__value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.compliance-gauge__number {
    font-family: var(--clieair-font-serif);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.compliance-gauge__label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    margin-top: 0.25rem;
}


/* --- Chat Bubbles ---
   For the legal bot chat interface */
.chat-bubble {
    max-width: 80%;
    padding: 0.875rem 1.125rem;
    border-radius: var(--clieair-radius-lg);
    font-size: 0.9375rem;
    line-height: 1.6;
    animation: fade-up 0.3s ease;
}

.chat-bubble--bot {
    background: var(--clieair-paper);
    border: 1px solid rgba(13, 27, 42, 0.08);
    border-bottom-left-radius: var(--clieair-radius-sm);
    align-self: flex-start;
}

.chat-bubble--user {
    background: var(--clieair-navy);
    color: white;
    border-bottom-right-radius: var(--clieair-radius-sm);
    align-self: flex-end;
}


/* ----------------------------------------------------------
   4. UTILITY CLASSES
   ---------------------------------------------------------- */

/* Gold gradient text */
.text-gradient-gold {
    background: linear-gradient(135deg, var(--clieair-gold) 0%, var(--clieair-gold-light) 50%, var(--clieair-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Animated glowing border */
.border-glow {
    border: 2px solid rgba(201, 162, 39, 0.3);
    animation: border-glow-rotate 3s ease-in-out infinite;
}

/* Status color utilities */
.status-green {
    color: var(--clieair-green);
}

.status-red {
    color: var(--clieair-red);
}

.status-yellow {
    color: var(--clieair-yellow);
}

.bg-status-green {
    background-color: rgba(34, 197, 94, 0.1);
}

.bg-status-red {
    background-color: rgba(239, 68, 68, 0.1);
}

.bg-status-yellow {
    background-color: rgba(234, 179, 8, 0.1);
}

/* Fade-up entrance (apply to elements that should animate in) */
.fade-up {
    animation: fade-up 0.6s ease forwards;
}

.fade-up-delay-1 { animation-delay: 0.1s; opacity: 0; }
.fade-up-delay-2 { animation-delay: 0.2s; opacity: 0; }
.fade-up-delay-3 { animation-delay: 0.3s; opacity: 0; }
.fade-up-delay-4 { animation-delay: 0.4s; opacity: 0; }

/* Loading spinner */
.clieair-spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--clieair-gold-light);
    border-top-color: var(--clieair-gold);
    border-radius: 50%;
    animation: clieair-spin 0.6s linear infinite;
}

/* Scale divider line */
.scale-divider {
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--clieair-gold), transparent);
}

/* Navy overlay gradient */
.overlay-navy {
    background: linear-gradient(to bottom, rgba(13, 27, 42, 0.03), transparent);
}

/* Scrollbar styling for custom panels */
.clieair-scroll::-webkit-scrollbar {
    width: 6px;
}

.clieair-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.clieair-scroll::-webkit-scrollbar-thumb {
    background: rgba(13, 27, 42, 0.15);
    border-radius: 3px;
}

.clieair-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 27, 42, 0.25);
}


/* ----------------------------------------------------------
   5. RESPONSIVE ADJUSTMENTS
   ---------------------------------------------------------- */

@media (max-width: 768px) {
    .beacon-card {
        padding: var(--clieair-space-md);
    }

    .ticker-strip__item {
        padding: 0 1rem;
        font-size: 0.75rem;
    }

    .compliance-gauge {
        width: 120px;
        height: 120px;
    }

    .compliance-gauge__number {
        font-size: 1.75rem;
    }

    .chat-bubble {
        max-width: 90%;
    }

    .clieair-toast {
        max-width: calc(100vw - 2rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .beacon-card {
        animation: none;
    }

    .ticker-strip__track {
        animation: none;
    }

    .border-glow {
        animation: none;
    }

    .compliance-badge::before {
        animation: none;
    }

    .fade-up,
    .fade-up-delay-1,
    .fade-up-delay-2,
    .fade-up-delay-3,
    .fade-up-delay-4 {
        animation: none;
        opacity: 1;
    }
}
