/**
 * ════════════════════════════════════════════════════════════════
 * COMPANIES DIRECTORY — Drive-Aligned Design v4.0
 * Compatible avec drive.css (variables, layout, dark/light mode)
 * ════════════════════════════════════════════════════════════════
 */

/* ========================================
   COMPANIES-SPECIFIC VARIABLES
   (s'ajoutent aux variables de drive.css)
   ======================================== */
   :root {
    --companies-primary:        #3b82f6;
    --companies-secondary:      #8b5cf6;
    --companies-gradient:       linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --companies-gradient-soft:  linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.08) 100%);
    --companies-success:        #10b981;
    --companies-danger:         #ef4444;
    --companies-warning:        #f59e0b;
}

/* ========================================
   CONTENT AREA OVERRIDE
   (force font-size cohérent avec Drive)
   ======================================== */
#avDriveContent {
    font-size: 14px;
}

/* ========================================
   GRADIENT TITLES
   ======================================== */
.gradient-title {
    background: var(--companies-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.section-title {
    font-size: 1.4rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--companies-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.section-title i {
    background: var(--companies-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   SECTION CARDS (style Drive)
   ======================================== */
.section {
    background: var(--avd-card);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius-lg);
    box-shadow: var(--avd-shadow);
    padding: 24px;
    margin-bottom: 18px;
    transition: var(--avd-transition);
    position: relative;
    overflow: hidden;
}

.section::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
    background: var(--companies-gradient);
    opacity: 0;
    transition: var(--avd-transition);
}

.section:hover {
    border-color: var(--avd-border-hover);
    transform: translateY(-1px);
    box-shadow: var(--avd-shadow-lg);
}

.section:hover::before {
    opacity: 1;
}

/* ========================================
   DROPDOWN SECTIONS (style Drive)
   ======================================== */
.dropdown-section {
    background: var(--avd-card);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius-lg);
    box-shadow: var(--avd-shadow);
    margin-bottom: 18px;
    transition: var(--avd-transition);
    overflow: hidden;
}

.dropdown-header {
    padding: 18px 24px;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--avd-transition);
    background: transparent;
    position: relative;
}

.dropdown-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 1px;
    background: var(--avd-border);
}

.dropdown-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

body.light-mode .dropdown-header:hover {
    background: rgba(0, 0, 0, 0.02);
}

.dropdown-title {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--companies-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    margin: 0;
}

.dropdown-title i {
    background: var(--companies-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dropdown-toggle {
    background: transparent;
    border: none;
    color: #667eea;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--avd-transition);
    padding: 6px;
    border-radius: 8px;
}

.dropdown-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.1);
}

.dropdown-toggle i {
    transition: transform 0.3s ease;
}

.dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
    padding: 0 24px;
}

.dropdown-content.open {
    max-height: 2000px;
    padding: 20px 24px 24px 24px;
}

/* ========================================
   SEARCH & FILTERS (style Drive inputs)
   ======================================== */
.search-toolbar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-bar {
    position: relative;
    width: 100%;
}

.search-bar i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--avd-text-dim);
    font-size: 13px;
    pointer-events: none;
    z-index: 1;
}

.search-bar input {
    width: 100%;
    padding: 12px 48px 12px 40px;
    background: var(--avd-input-bg);
    border: 1px solid var(--avd-border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--avd-text);
    transition: var(--avd-transition);
    outline: none;
    box-sizing: border-box;
}

.search-bar input:focus {
    border-color: var(--avd-primary);
    background: rgba(102, 126, 234, 0.05);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.search-bar input::placeholder {
    color: var(--avd-text-dim);
}

.clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--avd-transition);
    z-index: 1;
    font-size: 11px;
}

.clear-btn:hover {
    transform: translateY(-50%) scale(1.15) rotate(90deg);
    background: rgba(239, 68, 68, 0.25);
}

.filter-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 160px;
    padding: 9px 32px 9px 12px;
    background: var(--avd-input-bg);
    border: 1px solid var(--avd-border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--avd-text);
    cursor: pointer;
    transition: var(--avd-transition);
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    box-sizing: border-box;
}

.filter-select:hover {
    border-color: var(--avd-border-hover);
    background-color: rgba(255, 255, 255, 0.05);
}

body.light-mode .filter-select:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.filter-select:focus {
    border-color: var(--avd-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.filter-select option {
    background: #1e293b;
    color: var(--avd-text);
}

body.light-mode .filter-select option {
    background: #ffffff;
    color: #1e293b;
}

.filter-btn {
    padding: 9px 18px;
    background: linear-gradient(135deg, var(--avd-primary), var(--avd-primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--avd-transition);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.filter-btn:hover::before { left: 100%; }

.filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* ========================================
   VIEW TOGGLES
   ======================================== */
.section-header-with-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.view-toggles {
    display: flex;
    gap: 2px;
    background: var(--avd-input-bg);
    border: 1px solid var(--avd-border);
    border-radius: 10px;
    overflow: hidden;
}

.view-toggle {
    padding: 8px 14px;
    background: transparent;
    color: var(--avd-text-muted);
    border: none;
    font-size: 13px;
    cursor: pointer;
    transition: var(--avd-transition);
}

.view-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--avd-text);
}

body.light-mode .view-toggle:hover {
    background: rgba(0, 0, 0, 0.04);
}

.view-toggle.active {
    background: var(--avd-primary);
    color: white;
}

/* ========================================
   CHART WRAPPER
   ======================================== */
.chart-wrapper {
    background: var(--avd-input-bg);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius);
    overflow: hidden;
}

/* ========================================
   COMPANIES GRID
   ======================================== */
.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.company-card {
    background: var(--avd-card);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius-lg);
    padding: 18px;
    transition: var(--avd-transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.company-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
    background: var(--companies-gradient);
    opacity: 0;
    transition: var(--avd-transition);
}

.company-card:hover {
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
    transform: translateY(-2px);
}

.company-card:hover::before {
    opacity: 1;
}

.company-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.company-logo {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--avd-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    font-weight: 900;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    transition: var(--avd-transition);
}

body.light-mode .company-logo {
    background: rgba(0, 0, 0, 0.04);
}

.company-card:hover .company-logo {
    transform: scale(1.08) rotate(-3deg);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.25);
}

.company-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
    border-radius: 12px;
}

.company-logo.text-fallback {
    background: var(--companies-gradient);
    color: white;
    font-weight: 900;
    font-size: 1.3rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.company-info {
    flex: 1;
    min-width: 0;
}

.company-name {
    font-size: 13px;
    font-weight: 800;
    color: var(--avd-text);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-ticker {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(102, 126, 234, 0.15);
    color: #a5b4fc;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
}

body.light-mode .company-ticker {
    background: rgba(102, 126, 234, 0.12);
    color: #667eea;
}

.company-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.company-detail {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--avd-text-muted);
    font-weight: 600;
}

.company-detail i {
    color: var(--avd-primary);
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    font-size: 11px;
}

.company-sector {
    padding: 7px 12px;
    background: rgba(16, 185, 129, 0.08);
    color: #10b981;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    border: 1px solid rgba(16, 185, 129, 0.15);
    line-height: 1.4;
}

.company-region-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(59, 130, 246, 0.08);
    color: #60a5fa;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid rgba(59, 130, 246, 0.15);
}

body.light-mode .company-region-badge {
    color: #2563eb;
    background: rgba(59, 130, 246, 0.1);
}

/* ========================================
   ENRICHED BADGE
   ======================================== */
.enriched-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.5);
    z-index: 10;
    transition: var(--avd-transition);
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { box-shadow: 0 4px 10px rgba(16, 185, 129, 0.5); transform: scale(1); }
    50%       { box-shadow: 0 6px 18px rgba(16, 185, 129, 0.7); transform: scale(1.1); }
}

.enriched-badge:hover {
    transform: scale(1.25) rotate(15deg);
}

/* ========================================
   LIST & COMPACT VIEWS
   ======================================== */
.companies-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.companies-list .company-card {
    flex-direction: row;
    align-items: center;
    padding: 14px 18px;
}

.companies-list .company-header {
    flex: 0 0 auto;
    min-width: 260px;
}

.companies-list .company-details {
    flex: 1;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
}

.companies-list .company-sector {
    flex: 0 0 auto;
    min-width: 160px;
}

.companies-compact {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.companies-compact .company-card {
    padding: 12px;
    gap: 10px;
}

.companies-compact .company-logo {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    font-size: 1rem;
}

.companies-compact .company-name { font-size: 11px; }
.companies-compact .company-ticker { font-size: 9px; padding: 2px 7px; }
.companies-compact .company-details { display: none; }
.companies-compact .company-sector { padding: 5px 10px; font-size: 10px; }

/* ========================================
   PAGINATION (style Drive)
   ======================================== */
.pagination-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 24px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--avd-radius-lg);
    border: 1px solid var(--avd-border);
}

body.light-mode .pagination-wrapper {
    background: rgba(0, 0, 0, 0.02);
}

#paginationControls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--avd-border);
    border-radius: 8px;
    background: var(--avd-input-bg);
    color: var(--avd-text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--avd-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(.disabled) {
    background: rgba(102, 126, 234, 0.12);
    color: var(--avd-primary);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

.pagination-btn.active {
    background: var(--avd-primary);
    color: white;
    border-color: var(--avd-primary);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-ellipsis {
    color: var(--avd-text-dim);
    font-weight: 700;
    padding: 0 4px;
}

#paginationInfo {
    color: var(--avd-text-dim);
    font-size: 11px;
    font-weight: 600;
}

/* ========================================
   NO RESULTS
   ======================================== */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--avd-text-dim);
}

.no-results i {
    font-size: 3rem;
    color: var(--avd-text-dim);
    margin-bottom: 16px;
    display: block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

.no-results h3 {
    font-size: 1.2rem;
    font-weight: 800;
    background: var(--companies-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}

.no-results p {
    font-size: 12px;
    color: var(--avd-text-dim);
}

/* ========================================
   MODAL — Design minimaliste & pro
   ======================================== */
   .modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--avd-card);
    border: 1px solid var(--avd-border);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUpModal 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content.modal-large {
    max-width: 980px;
}

@keyframes slideUpModal {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--avd-border);
    background: var(--avd-card);
}

.modal-header h2 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--avd-text);
    font-weight: 700;
    margin: 0;
}

.modal-header h2 i {
    color: var(--avd-primary);
}

.modal-close {
    background: var(--avd-input-bg);
    border: 1px solid var(--avd-border);
    font-size: 1.1rem;
    color: var(--avd-text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--avd-transition);
    font-family: inherit;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.25);
}

.modal-body {
    padding: 24px;
}

/* Sections internes — sobres, plates, bordure fine */
.modal-section {
    background: var(--avd-input-bg);
    border: 1px solid var(--avd-border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
}

.modal-section h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--avd-text);
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-section h4 i {
    color: var(--avd-primary);
}

.modal-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.modal-detail-item .detail-label {
    font-size: 10px;
    color: var(--avd-text-dim);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.modal-detail-item .detail-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--avd-text);
    word-wrap: break-word;
}

/* Logo entreprise dans le modal — flat, neutre */
.modal-company-logo {
    width: 88px;
    height: 88px;
    background: var(--avd-input-bg);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    border: 1px solid var(--avd-border);
    overflow: hidden;
}

.modal-company-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

.modal-company-logo.text-fallback {
    background: var(--avd-primary);
    color: white;
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: 1px;
}

/* KG Score modal — sobre */
.kg-score-explanation {
    padding: 18px;
    background: var(--avd-input-bg);
    border: 1px solid var(--avd-border);
    border-radius: 12px;
    margin-top: 14px;
}

.kg-score-scale {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 14px 0;
    padding: 12px;
    background: var(--avd-card);
    border-radius: 10px;
    border: 1px solid var(--avd-border);
}

.kg-score-scale-item { text-align: center; flex: 1; }

.kg-score-scale-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--avd-text);
}

.kg-score-scale-label {
    font-size: 10px;
    color: var(--avd-text-dim);
    font-weight: 600;
    margin-top: 3px;
}

/* Scrollbar modal */
.modal-content::-webkit-scrollbar { width: 4px; }
.modal-content::-webkit-scrollbar-track { background: transparent; }
.modal-content::-webkit-scrollbar-thumb {
    background: var(--avd-border-hover);
    border-radius: 4px;
}

/* Favorites modal — sobre, cohérent */
.favorites-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

.favorites-modal-overlay.active {
    display: flex;
}

.favorites-modal-box {
    background: var(--avd-card);
    border: 1px solid var(--avd-border);
    border-radius: 16px;
    padding: 22px;
    max-width: 520px;
    width: 90%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    position: relative;
}

/* ========================================
   STATISTICS GRID
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.stat-card {
    background: var(--avd-card);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius-lg);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--avd-transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
    background: var(--companies-gradient);
    opacity: 0;
    transition: var(--avd-transition);
}

.stat-card:hover {
    border-color: var(--avd-border-hover);
    transform: translateY(-2px);
    box-shadow: var(--avd-shadow);
}

.stat-card:hover::before { opacity: 1; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    transition: var(--avd-transition);
}

.stat-card:hover .stat-icon {
    transform: scale(1.12) rotate(-8deg);
}

.stat-content { flex: 1; }

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    background: var(--companies-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-label {
    font-size: 10px;
    color: var(--avd-text-dim);
    font-weight: 700;
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   FAVORITE BUTTON ON COMPANY CARD
   ======================================== */
.company-favorite-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    top: unset;
    left: unset;
    width: 26px;
    height: 26px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 900;
    transition: var(--avd-transition);
    z-index: 10;
}

.company-favorite-btn:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.company-favorite-btn.in-favorites {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.company-favorite-btn.in-favorites:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.company-card .company-sector {
    margin-right: 32px;
}

/* ========================================
   MY FAVORITES SECTION
   ======================================== */
.my-favorites-section {
    background: var(--avd-card);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius-lg);
    box-shadow: var(--avd-shadow);
    margin-bottom: 18px;
    overflow: hidden;
}

.my-favorites-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.05));
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--avd-border);
    cursor: pointer;
    user-select: none;
    transition: var(--avd-transition);
}

.my-favorites-header:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.08));
}

.my-favorites-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 900;
    color: var(--avd-text);
}

.my-favorites-title i {
    color: #f59e0b;
    font-size: 13px;
}

.my-favorites-title .fav-count-badge {
    font-size: 10px;
    font-weight: 800;
    background: rgba(102, 126, 234, 0.18);
    color: #a5b4fc;
    padding: 2px 8px;
    border-radius: 20px;
}

.my-favorites-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.my-favorites-manage-btn {
    padding: 5px 12px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--avd-primary);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--avd-transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.my-favorites-manage-btn:hover {
    background: rgba(102, 126, 234, 0.18);
    border-color: var(--avd-primary);
}

.my-favorites-toggle-icon {
    color: var(--avd-text-dim);
    font-size: 11px;
    transition: transform 0.3s ease;
}

.my-favorites-toggle-icon.rotated {
    transform: rotate(180deg);
}

.my-favorites-body {
    padding: 18px 20px;
    display: none;
}

.my-favorites-body.open {
    display: block;
}

/* Tabs des listes favorites */
.fav-lists-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.fav-list-tab {
    padding: 5px 14px;
    background: rgba(102, 126, 234, 0.07);
    color: var(--avd-primary);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 20px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--avd-transition);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.fav-list-tab:hover {
    background: rgba(102, 126, 234, 0.14);
    border-color: var(--avd-primary);
}

.fav-list-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

.fav-list-tab .tab-count {
    background: rgba(255, 255, 255, 0.25);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 800;
}

.fav-list-tab:not(.active) .tab-count {
    background: rgba(102, 126, 234, 0.15);
    color: var(--avd-primary);
}

/* Toggle vue logos / cartes */
.fav-view-toggle-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.fav-view-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--avd-text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.fav-view-btns {
    display: flex;
    gap: 4px;
}

.fav-view-btn {
    padding: 4px 10px;
    background: var(--avd-input-bg);
    color: var(--avd-text-muted);
    border: 1px solid var(--avd-border);
    border-radius: 7px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--avd-transition);
    display: flex;
    align-items: center;
    gap: 4px;
}

.fav-view-btn.active,
.fav-view-btn:hover {
    background: var(--avd-primary);
    color: white;
    border-color: transparent;
}

/* Grille logos */
.fav-logos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

/* Grille cartes */
.fav-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Logo item */
.fav-logo-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: var(--avd-input-bg);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius);
    cursor: pointer;
    transition: var(--avd-transition);
    position: relative;
}

.fav-logo-item:hover {
    transform: translateY(-3px);
    border-color: var(--avd-primary);
    box-shadow: var(--avd-shadow);
}

.fav-logo-img-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--avd-border);
}

body.light-mode .fav-logo-img-wrap {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
}

.fav-logo-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
}

.fav-logo-initials {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 900;
    color: white;
}

.fav-logo-name {
    font-size: 9px;
    font-weight: 800;
    color: var(--avd-text);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.fav-logo-ticker {
    font-size: 8px;
    font-weight: 800;
    color: var(--avd-primary);
    text-align: center;
    background: rgba(102, 126, 234, 0.1);
    padding: 1px 5px;
    border-radius: 6px;
}

/* Remove btn sur logo item */
.fav-logo-remove {
    position: absolute;
    top: 3px; right: 3px;
    width: 18px; height: 18px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--avd-red);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    opacity: 0;
    transition: var(--avd-transition);
}

.fav-logo-item:hover .fav-logo-remove { opacity: 1; }
.fav-logo-remove:hover { background: rgba(239, 68, 68, 0.22); }

/* Card item */
.fav-card-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--avd-input-bg);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius);
    cursor: pointer;
    transition: var(--avd-transition);
    position: relative;
}

.fav-card-item:hover {
    transform: translateY(-2px);
    border-color: var(--avd-primary);
    box-shadow: var(--avd-shadow);
}

.fav-card-item:hover .fav-card-remove { opacity: 1; }

.fav-card-logo-wrap {
    width: 44px; height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--avd-border);
}

body.light-mode .fav-card-logo-wrap {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
}

.fav-card-logo-wrap img {
    width: 100%; height: 100%;
    object-fit: contain;
    padding: 4px;
}

.fav-card-info { flex: 1; min-width: 0; }

.fav-card-name {
    font-weight: 800;
    font-size: 12px;
    color: var(--avd-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.fav-card-ticker {
    display: inline-block;
    font-size: 9px;
    font-weight: 800;
    color: var(--avd-primary);
    background: rgba(102, 126, 234, 0.1);
    padding: 1px 7px;
    border-radius: 20px;
    margin-bottom: 2px;
}

.fav-card-meta {
    font-size: 10px;
    color: var(--avd-text-dim);
    display: flex;
    align-items: center;
    gap: 4px;
}

.fav-card-remove {
    position: absolute;
    top: 8px; right: 8px;
    width: 24px; height: 24px;
    background: rgba(239, 68, 68, 0.08);
    color: var(--avd-red);
    border: none;
    border-radius: 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    opacity: 0;
    transition: var(--avd-transition);
}

.fav-card-remove:hover { background: rgba(239, 68, 68, 0.18); }

/* État vide */
.fav-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--avd-radius);
    border: 1px dashed rgba(102, 126, 234, 0.2);
}

body.light-mode .fav-empty-state {
    background: rgba(0, 0, 0, 0.02);
}

.fav-empty-state i {
    font-size: 2rem;
    color: var(--avd-text-dim);
    display: block;
    margin-bottom: 10px;
}

.fav-empty-state p { font-weight: 700; color: var(--avd-text-muted); margin-bottom: 5px; font-size: 13px; }
.fav-empty-state small { color: var(--avd-text-dim); font-size: 11px; }

/* État no-lists */
.fav-no-lists {
    text-align: center;
    padding: 28px 16px;
}

.fav-no-lists i {
    font-size: 2.5rem;
    color: var(--avd-text-dim);
    display: block;
    margin-bottom: 12px;
}

.fav-no-lists p { font-weight: 700; color: var(--avd-text-muted); margin-bottom: 5px; font-size: 13px; }
.fav-no-lists small { color: var(--avd-text-dim); font-size: 11px; }

/* ========================================
   FAVORITES MODAL OVERLAY
   ======================================== */
.favorites-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.65);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.favorites-modal-overlay.active {
    display: flex;
}

.favorites-modal-box {
    background: #1a2235;
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius-xl);
    padding: 22px;
    max-width: 520px;
    width: 90%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--avd-shadow-lg);
    position: relative;
}

body.light-mode .favorites-modal-box {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
}

/* ========================================
   LOADER RING
   ======================================== */
.fav-loader-ring {
    width: 32px; height: 32px;
    border: 2.5px solid rgba(102, 126, 234, 0.12);
    border-top: 2.5px solid #667eea;
    border-radius: 50%;
    animation: favSpin 0.75s linear infinite;
    margin: 0 auto;
}

@keyframes favSpin {
    to { transform: rotate(360deg); }
}

/* ========================================
   CHART LOADING SPINNER
   ======================================== */
.chart-loading-spinner {
    width: 48px; height: 48px;
    border: 3px solid rgba(102, 126, 234, 0.1);
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin-modern 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    margin: 0 auto;
}

@keyframes spin-modern {
    0%   { transform: rotate(0deg);   border-top-color: #667eea; }
    50%  {                             border-top-color: #764ba2; }
    100% { transform: rotate(360deg); border-top-color: #667eea; }
}

.chart-loading-text {
    font-size: 13px;
    font-weight: 700;
    background: var(--companies-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   LOGO INITIALS FALLBACK
   ======================================== */
.logo-initials-fallback {
    background: rgba(102, 126, 234, 0.08) !important;
    border: 1px solid rgba(102, 126, 234, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.initials-text {
    font-size: 1.1rem;
    font-weight: 900;
    background: var(--companies-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.85;
}

.company-card:hover .logo-initials-fallback {
    background: rgba(102, 126, 234, 0.14) !important;
    border-color: rgba(102, 126, 234, 0.28) !important;
}

.logo-initials-fallback-modal {
    background: rgba(102, 126, 234, 0.1) !important;
    border: 1px solid rgba(102, 126, 234, 0.2) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.initials-text-modal {
    font-size: 2rem;
    font-weight: 900;
    background: var(--companies-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ========================================
   KG SCORE MODAL
   ======================================== */
.kg-score-explanation {
    padding: 20px;
    background: var(--companies-gradient-soft);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius);
    margin-top: 16px;
}

.kg-score-scale {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 16px 0;
    padding: 14px;
    background: var(--avd-input-bg);
    border-radius: var(--avd-radius);
    border: 1px solid var(--avd-border);
}

.kg-score-scale-item { text-align: center; flex: 1; }

.kg-score-scale-value {
    font-size: 1.1rem;
    font-weight: 800;
    background: var(--companies-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.kg-score-scale-label {
    font-size: 10px;
    color: var(--avd-text-dim);
    font-weight: 600;
    margin-top: 3px;
}

/* ========================================
   SCROLLBAR (modal)
   ======================================== */
.modal-content::-webkit-scrollbar { width: 4px; }
.modal-content::-webkit-scrollbar-track { background: transparent; }
.modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

/* ========================================
   LIGHT MODE ADJUSTMENTS
   ======================================== */
body.light-mode .modal-content {
    background: #ffffff;
}

body.light-mode .company-card:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

body.light-mode .company-sector {
    background: rgba(16, 185, 129, 0.07);
}

body.light-mode .company-ticker {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

body.light-mode .fav-list-tab:not(.active) .tab-count {
    color: #667eea;
}

body.light-mode .logo-initials-fallback {
    background: rgba(102, 126, 234, 0.06) !important;
}

body.light-mode .logo-initials-fallback-modal {
    background: rgba(102, 126, 234, 0.07) !important;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes moveStripes {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* ========================================
   RESPONSIVE — TABLET (≤ 1024px)
   ======================================== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .companies-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* ========================================
   RESPONSIVE — MOBILE (≤ 768px)
   ======================================== */
@media (max-width: 768px) {
    #avDriveContent {
        padding: 14px !important;
    }

    .section,
    .dropdown-content.open {
        padding: 16px;
    }

    .dropdown-header {
        padding: 14px 16px;
    }

    .section-title,
    .dropdown-title {
        font-size: 1.1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 12px 10px;
        gap: 6px;
    }

    .stat-icon {
        width: 36px; height: 36px;
        font-size: 1rem;
        border-radius: 10px;
    }

    .stat-value { font-size: 1.4rem; }
    .stat-label { font-size: 9px; }

    .filter-controls { flex-direction: column; }
    .filter-select,
    .filter-btn { width: 100%; }

    .section-header-with-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .view-toggles {
        width: 100%;
        justify-content: center;
    }

    /* 2 companies par ligne */
    .companies-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .company-card {
        padding: 12px !important;
    }

    .company-logo {
        width: 40px !important; height: 40px !important;
        min-width: 40px !important; min-height: 40px !important;
    }

    .company-name { font-size: 11px !important; }
    .company-ticker { font-size: 9px !important; padding: 2px 7px !important; }
    .company-sector { font-size: 9px !important; padding: 5px 8px !important; }

    .companies-list .company-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .companies-list .company-header {
        width: 100%;
    }

    .companies-compact {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Modal */
    .modal { padding: 8px; }
    .modal-header { padding: 16px; }
    .modal-body { padding: 16px; }
    .modal-detail-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .modal-detail-item {
        background: var(--avd-card);
        padding: 12px 14px;
        border-radius: 10px;
        border: 1px solid var(--avd-border) !important;
        border-left: 1px solid var(--avd-border) !important;
    }
    .modal-detail-item .detail-label { font-size: 9px !important; }
    .modal-detail-item .detail-value { font-size: 11px !important; }

    /* KG Score scale */
    .kg-score-scale {
        flex-direction: column;
        gap: 8px;
    }

    .kg-score-scale-item {
        width: 100%;
        padding: 6px;
        background: var(--avd-input-bg);
        border-radius: 6px;
    }

    /* Initials */
    .initials-text { font-size: 0.9rem !important; }
    .initials-text-modal { font-size: 1.6rem !important; }

    /* Table */
    table { font-size: 11px; }
    table th, table td { padding: 8px 10px !important; }
}

/* ========================================
   RESPONSIVE — SMALL MOBILE (≤ 480px)
   ======================================== */
@media (max-width: 480px) {
    .companies-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .company-card { padding: 10px !important; }

    .company-logo {
        width: 36px !important; height: 36px !important;
        min-width: 36px !important; min-height: 36px !important;
        font-size: 0.85rem !important;
    }

    .company-name { font-size: 10px !important; }
    .company-ticker { font-size: 8px !important; padding: 1px 5px !important; }
    .company-sector { font-size: 8px !important; padding: 4px 7px !important; }

    .stats-grid { gap: 8px; }
    .stat-card { padding: 8px; }
    .stat-value { font-size: 1.2rem; }
    .stat-label { font-size: 8px; }

    .initials-text { font-size: 0.75rem !important; }
    .initials-text-modal { font-size: 1.3rem !important; }

    .companies-compact { grid-template-columns: 1fr; }
}