/**
 * AI Act Ready - Backend Theme Color Override
 * Harmonizes backend colors with EU color scheme
 * IMPORTANT: This file MUST be loaded AFTER style.css
 *
 * EU Colors:
 * - Primary Blue: #003399
 * - EU Gold: #FFCC00
 * - Success Green: #28a745
 * - Light Blue: #0052cc
 */

/* ========================================
   ROOT VARIABLE OVERRIDES - CRITICAL!
   These override the purple colors from style.css
   ======================================== */
:root {
    /* Override theme purple colors with EU Blue */
    --primary: #003399 !important;
    --secondary: #001a4d !important;
    --purple: #003399 !important;

    /* AI Act Ready EU Colors */
    --aiact-primary: #003399;
    --aiact-primary-light: #0052cc;
    --aiact-primary-dark: #002266;
    --aiact-secondary: #001a4d;
    --aiact-gold: #FFCC00;
    --aiact-gold-dark: #e6b800;

    /* Status Colors */
    --aiact-success: #28a745;
    --aiact-warning: #ffc107;
    --aiact-danger: #dc3545;
    --aiact-info: #17a2b8;

    /* Backgrounds */
    --aiact-bg-light: #f8f9fc;
    --aiact-bg-card: #ffffff;

    /* Risk Level Colors */
    --risk-minimal: #28a745;
    --risk-limited: #ffc107;
    --risk-high: #fd7e14;
    --risk-unacceptable: #dc3545;
}

/* ========================================
   GLOBAL COLOR OVERRIDE
   Mass override for purple colors #593bdb, #673BB7
   ======================================== */

/* All elements with purple background */
[style*="593bdb"],
[style*="673BB7"] {
    background-color: var(--aiact-primary) !important;
}

/* ========================================
   PRIMARY/SECONDARY COLOR OVERRIDES
   ======================================== */

/* Background primary */
.bg-primary {
    background-color: #003399 !important;
}

.bg-secondary {
    background-color: #001a4d !important;
}

/* Text colors - override all purple instances */
.text-primary,
a.text-primary,
.text-primary-dark {
    color: #003399 !important;
}

.text-secondary {
    color: #001a4d !important;
}

/* Links */
a {
    color: #003399;
}

a:hover {
    color: #002266;
}

/* ========================================
   BUTTONS - Complete Override
   ======================================== */

.btn-primary,
.btn-primary.disabled,
.btn-primary:disabled {
    background-color: #003399 !important;
    border-color: #003399 !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled).active,
.show > .btn-primary.dropdown-toggle {
    background-color: #002266 !important;
    border-color: #002266 !important;
    color: #fff !important;
}

.btn-secondary,
.btn-secondary.disabled,
.btn-secondary:disabled {
    background-color: #001a4d !important;
    border-color: #001a4d !important;
    color: #fff !important;
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active,
.btn-secondary.active,
.btn-secondary:not(:disabled):not(.disabled):active,
.btn-secondary:not(:disabled):not(.disabled).active,
.show > .btn-secondary.dropdown-toggle {
    background-color: #00102e !important;
    border-color: #00102e !important;
    color: #fff !important;
}

.btn-outline-primary {
    color: #003399 !important;
    border-color: #003399 !important;
    background-color: transparent !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-primary.active {
    background-color: #003399 !important;
    border-color: #003399 !important;
    color: #fff !important;
}

.btn-outline-secondary {
    color: #001a4d !important;
    border-color: #001a4d !important;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background-color: #001a4d !important;
    color: #fff !important;
}

/* Gold button (for CTAs) */
.btn-warning,
.btn-gold {
    background-color: #FFCC00 !important;
    border-color: #FFCC00 !important;
    color: #003399 !important;
}

.btn-warning:hover,
.btn-gold:hover {
    background-color: #e6b800 !important;
    border-color: #e6b800 !important;
    color: #003399 !important;
}

/* ========================================
   BADGES
   ======================================== */

.badge-primary {
    background-color: #003399 !important;
    color: #fff !important;
}

.badge-secondary {
    background-color: #001a4d !important;
    color: #fff !important;
}

.badge-warning {
    background-color: #FFCC00 !important;
    color: #003399 !important;
}

/* ========================================
   BORDERS
   ======================================== */

.border-primary {
    border-color: #003399 !important;
}

.border-secondary {
    border-color: #001a4d !important;
}

/* ========================================
   PAGE TITLES / HEADER
   ======================================== */

.page-titles {
    background: #003399 !important;
    border-radius: 8px;
    margin-bottom: 25px;
}

.page-titles .welcome-text h4,
.page-titles h4,
.page-titles .page-title {
    color: #fff !important;
}

/* Star icon and other icons in page titles - EU Gold */
.page-titles .welcome-text h4 i,
.page-titles h4 i,
.page-titles i {
    color: #FFCC00 !important;
}

.page-titles .welcome-text span,
.page-titles span,
.page-titles .page-title-sub {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Breadcrumb */
.page-titles .breadcrumb {
    background: transparent !important;
}

.page-titles .breadcrumb-item,
.page-titles .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.8) !important;
}

.page-titles .breadcrumb-item a:hover {
    color: #FFCC00 !important;
}

.page-titles .breadcrumb-item.active {
    color: #fff !important;
}

.page-titles .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* ========================================
   SIDEBAR (.quixnav) - CORRECTED CLASS
   ======================================== */

/* Sidebar container background */
.quixnav {
    background: linear-gradient(180deg, #003399 0%, #001a4d 100%) !important;
}

.quixnav .quixnav-scroll {
    background: transparent !important;
}

/* Menu items */
.quixnav .metismenu > li > a {
    color: rgba(255, 255, 255, 0.8) !important;
}

.quixnav .metismenu > li > a i {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Hover and Active states */
.quixnav .metismenu > li:hover > a,
.quixnav .metismenu > li:focus > a,
.quixnav .metismenu > li.mm-active > a {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.quixnav .metismenu > li:hover > a i,
.quixnav .metismenu > li:focus > a i,
.quixnav .metismenu > li.mm-active > a i {
    color: #FFCC00 !important;
}

/* Active menu item - gold left border */
.quixnav .metismenu > li.mm-active > a {
    border-left: 4px solid #FFCC00 !important;
}

/* Submenu items */
.quixnav .metismenu ul {
    background: rgba(0, 0, 0, 0.15) !important;
}

.quixnav .metismenu ul a {
    color: rgba(255, 255, 255, 0.7) !important;
}

.quixnav .metismenu ul a:hover,
.quixnav .metismenu ul a:focus,
.quixnav .metismenu ul a.mm-active {
    color: #fff !important;
}

/* Menu label/divider */
.quixnav .metismenu .nav-label {
    color: rgba(255, 255, 255, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Arrow icons */
.quixnav .metismenu .has-arrow:after {
    border-color: rgba(255, 255, 255, 0.7) !important;
}

.quixnav .metismenu .mm-active > .has-arrow:after,
.quixnav .metismenu .has-arrow[aria-expanded="true"]:after {
    border-color: #FFCC00 !important;
}

/* ========================================
   NAV HEADER (Logo area)
   ======================================== */

.nav-header {
    background: #003399 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Hamburger menu */
.nav-header .hamburger .line {
    background: #fff !important;
}

.nav-control {
    background: transparent !important;
}

/* Logo styling - hide broken images, show text */
.brand-logo {
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
}

.brand-logo .logo-abbr {
    max-width: 40px !important;
    height: auto !important;
}

/* Hide broken logo-compact and brand-title images */
.brand-logo .logo-compact,
.brand-logo .brand-title {
    display: none !important;
}

/* Show CSS text logo instead */
.brand-logo::after {
    content: "AI Act Ready";
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    margin-left: 10px;
    white-space: nowrap;
}

/* When sidebar is collapsed, hide text logo */
[data-sidebar-style="mini"] .brand-logo::after,
.menu-toggle .brand-logo::after {
    display: none;
}

/* ========================================
   HEADER
   ======================================== */

.header {
    background: #fff !important;
    border-bottom: 1px solid #e6e6e6 !important;
}

.header-left .dashboard_bar {
    color: #003399 !important;
}

/* Header profile dropdown */
.header-profile .nav-link {
    color: #003399 !important;
}

/* ========================================
   GRADIENTS - Override purple gradients
   ======================================== */

.gradient-1,
.gradient-2,
.gradient-3,
.gradient-4,
.gradient-5,
[class*="gradient-"] {
    background: linear-gradient(135deg, #003399 0%, #0052cc 100%) !important;
}

/* Gold accent gradients */
.gradient-6,
.gradient-7,
.gradient-8 {
    background: linear-gradient(135deg, #FFCC00 0%, #e6b800 100%) !important;
    color: #003399 !important;
}

/* Success gradients */
.gradient-9,
.gradient-10 {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
}

/* ========================================
   CARDS & WIDGETS
   ======================================== */

.card {
    border: none;
    box-shadow: 0 0 20px rgba(0, 51, 153, 0.08);
    border-radius: 12px;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #e6e6e6;
}

.card-title {
    color: #003399 !important;
}

/* Stat cards */
.widget-stat .media .media-body h4 {
    color: #003399 !important;
}

/* ========================================
   FORMS
   ======================================== */

.form-control:focus {
    border-color: #003399 !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 51, 153, 0.15) !important;
}

.custom-control-input:checked ~ .custom-control-label::before {
    background-color: #003399 !important;
    border-color: #003399 !important;
}

/* Select2 */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #003399 !important;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default .select2-selection--multiple:focus {
    border-color: #003399 !important;
}

/* ========================================
   TABLES
   ======================================== */

.table thead th {
    background: #f8f9fc !important;
    color: #003399 !important;
    font-weight: 600;
    border-bottom: 2px solid #003399 !important;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 51, 153, 0.04) !important;
}

/* DataTables */
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #003399 !important;
    border-color: #003399 !important;
    color: #fff !important;
}

/* ========================================
   PAGINATION
   ======================================== */

.page-item.active .page-link {
    background-color: #003399 !important;
    border-color: #003399 !important;
}

.page-link {
    color: #003399 !important;
}

.page-link:hover {
    color: #002266 !important;
}

/* ========================================
   ALERTS
   ======================================== */

.alert-primary {
    background-color: rgba(0, 51, 153, 0.1) !important;
    border-color: #003399 !important;
    color: #003399 !important;
}

.alert-secondary {
    background-color: rgba(0, 26, 77, 0.1) !important;
    border-color: #001a4d !important;
    color: #001a4d !important;
}

/* ========================================
   DROPDOWN MENUS
   ======================================== */

.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item.active,
.dropdown-item:active {
    background-color: rgba(0, 51, 153, 0.1) !important;
    color: #003399 !important;
}

/* ========================================
   NAV TABS & PILLS
   ======================================== */

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    border-color: #003399 !important;
    color: #003399 !important;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: #003399 !important;
    color: #fff !important;
}

.nav-link {
    color: #003399 !important;
}

.nav-link:hover {
    color: #002266 !important;
}

/* ========================================
   CHECKBOX & RADIO - Custom styles
   ======================================== */

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    accent-color: #003399 !important;
}

.custom-checkbox .custom-control-input:checked ~ .custom-control-label::before {
    background-color: #003399 !important;
    border-color: #003399 !important;
}

.custom-radio .custom-control-input:checked ~ .custom-control-label::before {
    background-color: #003399 !important;
    border-color: #003399 !important;
}

/* ========================================
   PROGRESS BARS
   ======================================== */

.progress {
    background-color: #e9ecef;
    border-radius: 10px;
    height: 8px;
}

.progress-bar {
    border-radius: 10px;
}

.progress-bar,
.progress-bar.bg-primary {
    background-color: #003399 !important;
}

/* ========================================
   SPINNERS & LOADERS
   ======================================== */

.spinner-border,
.spinner-grow {
    color: #003399 !important;
}

.sk-three-bounce .sk-child {
    background-color: #003399 !important;
}

/* ========================================
   SWEET ALERT
   ======================================== */

.swal2-confirm.swal2-styled {
    background-color: #003399 !important;
    border-color: #003399 !important;
}

.swal2-confirm.swal2-styled:hover {
    background-color: #002266 !important;
}

/* ========================================
   TOASTR NOTIFICATIONS
   ======================================== */

.toast-success {
    background-color: #28a745 !important;
}

.toast-info {
    background-color: #003399 !important;
}

/* ========================================
   RISK LEVEL BADGES (AI Act specific)
   ======================================== */

.risk-badge {
    display: inline-block;
    padding: 0.35em 0.75em;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.risk-badge-minimal {
    background-color: rgba(40, 167, 69, 0.15);
    color: #28a745;
}

.risk-badge-limited {
    background-color: rgba(255, 193, 7, 0.2);
    color: #856404;
}

.risk-badge-high {
    background-color: rgba(253, 126, 20, 0.15);
    color: #fd7e14;
}

.risk-badge-unacceptable {
    background-color: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

/* ========================================
   DASHBOARD SPECIFIC STYLES
   ======================================== */

/* Stat cards with icons */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 0 20px rgba(0, 51, 153, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(0, 51, 153, 0.12);
}

.stat-card .icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .icon.primary {
    background: linear-gradient(135deg, #003399 0%, #0052cc 100%);
    color: #fff;
}

.stat-card .icon.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
}

.stat-card .icon.warning {
    background: linear-gradient(135deg, #FFCC00 0%, #e6b800 100%);
    color: #003399;
}

.stat-card .icon.info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: #fff;
}

/* Project cards */
.project-card {
    border-left: 4px solid #003399;
    transition: border-color 0.2s;
}

.project-card.risk-minimal {
    border-left-color: #28a745;
}

.project-card.risk-limited {
    border-left-color: #ffc107;
}

.project-card.risk-high {
    border-left-color: #fd7e14;
}

.project-card.risk-unacceptable {
    border-left-color: #dc3545;
}

/* ========================================
   TIMELINE
   ======================================== */

.timeline .timeline-badge.primary {
    background-color: #003399 !important;
}

.timeline-panel {
    border-left-color: #003399 !important;
}

/* ========================================
   CALENDAR / DATE PICKER
   ======================================== */

.fc-button-primary {
    background-color: #003399 !important;
    border-color: #003399 !important;
}

.fc-button-primary:hover {
    background-color: #002266 !important;
    border-color: #002266 !important;
}

.fc-day-today {
    background-color: rgba(0, 51, 153, 0.1) !important;
}

/* ========================================
   CHART COLORS (override purple in charts)
   ======================================== */

/* Morris charts, Chart.js, etc. - handled via JS typically */

/* ========================================
   DARK MODE ADJUSTMENTS
   ======================================== */

[data-theme-version="dark"] .quixnav {
    background: linear-gradient(180deg, #001a4d 0%, #000d26 100%) !important;
}

[data-theme-version="dark"] .nav-header {
    background: #001a4d !important;
}

[data-theme-version="dark"] .card {
    background: #2a2c32;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

[data-theme-version="dark"] .stat-card {
    background: #2a2c32;
}

[data-theme-version="dark"] .table thead th {
    background: #323a4b !important;
    color: #fff !important;
}

[data-theme-version="dark"] .doc-card {
    border-color: #424d63;
    background: transparent;
}

[data-theme-version="dark"] .doc-card:hover {
    border-color: #0052cc;
}

[data-theme-version="dark"] .page-titles {
    background: #002266 !important;
}

/* ========================================
   MISC OVERRIDES FOR STUBBORN PURPLE
   ======================================== */

/* SVG fills */
svg [fill="#593bdb"],
svg [fill="#673BB7"] {
    fill: #003399 !important;
}

/* Inline styles override (less specific but catches some) */
.bg-primary[style*="background"],
[class*="bg-primary"] {
    background-color: #003399 !important;
}

/* Focus rings */
*:focus {
    outline-color: #003399 !important;
}

.btn:focus,
.form-control:focus,
.custom-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 51, 153, 0.25) !important;
}

/* Link colors in various contexts */
.card a:not(.btn),
.widget a:not(.btn),
.list-group-item a:not(.btn) {
    color: #003399;
}

.card a:not(.btn):hover,
.widget a:not(.btn):hover,
.list-group-item a:not(.btn):hover {
    color: #002266;
}

/* ========================================
   NOTIFICATION BELL
   ======================================== */

.notification_dropdown .nav-link .pulse-css {
    background-color: #dc3545 !important;
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
    background: #f8f9fc;
    border-top: 1px solid #e6e6e6;
}

.footer .copyright p {
    color: #666;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 767.98px) {
    .stat-card {
        padding: 1rem;
    }

    .stat-card .icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .brand-logo::after {
        font-size: 0.9rem;
    }
}

/* ========================================
   AI ACT READY BRANDING
   ======================================== */

.aiact-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.aiact-logo .logo-icon {
    width: 32px;
    height: 32px;
    background: #FFCC00;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #003399;
    font-weight: 700;
}

.aiact-logo .logo-text {
    font-weight: 700;
    color: #fff;
    font-size: 1.1rem;
}

.aiact-logo .logo-text span {
    color: #FFCC00;
}

/* ========================================
   PREMIUM/DISABLED FEATURE STYLING
   For subscription gating UI
   ======================================== */

.feature-disabled {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.feature-disabled::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}

.feature-requires-plan {
    cursor: pointer !important;
    pointer-events: auto !important;
}

.feature-requires-plan:hover {
    opacity: 0.7;
}

.premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #FFCC00 0%, #e6b800 100%);
    color: #003399;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.premium-badge i {
    font-size: 0.65rem;
}

/* Premium disabled state (from JS gating) */
.premium-disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
    position: relative;
}

.premium-disabled:hover {
    opacity: 0.7;
}

/* Premium action card styling */
.card.premium-action {
    border: 2px dashed #e4e6ef;
    transition: all 0.2s;
}

.card.premium-action:hover {
    border-color: #FFCC00;
    background: rgba(255, 204, 0, 0.05);
}

/* Opacity utility */
.opacity-75 {
    opacity: 0.75 !important;
}

/* ========================================
   PREMIUM OVERLAY (for AI Chat, etc.)
   ======================================== */

.premium-overlay-container {
    position: relative;
}

.premium-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.97);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    border-radius: 0 0 8px 8px;
    backdrop-filter: blur(5px);
}

.premium-overlay-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #003399 0%, #001a4d 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 10px 40px rgba(0, 51, 153, 0.3);
}

.premium-overlay-icon i {
    font-size: 40px;
    color: #FFCC00;
}

.premium-overlay h3 {
    color: #003399;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.premium-overlay p {
    color: #666;
    font-size: 16px;
    max-width: 400px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.premium-overlay .premium-features {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-bottom: 32px;
    max-width: 500px;
}

.premium-overlay .premium-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: #333;
}

.premium-overlay .premium-feature i {
    color: #003399;
}

.premium-overlay .btn-upgrade {
    background: linear-gradient(135deg, #003399 0%, #001a4d 100%);
    color: #fff;
    padding: 14px 40px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    border: none;
}

.premium-overlay .btn-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 51, 153, 0.4);
    color: #fff;
}

.premium-overlay .btn-upgrade i {
    color: #FFCC00;
}

.chat-locked .chat-messages,
.chat-locked .chat-input {
    filter: blur(3px);
    pointer-events: none;
    user-select: none;
}
