/* ========================================
   COMPONENTS UI
   ======================================== */

/* --- Forms & Inputs --- */
input, select, button { 
    padding: 12px 16px; font-size: 14px; font-family: inherit;
    border: 1px solid var(--border-color); border-radius: 8px;
    background: var(--bg-card); color: var(--text-primary);
    transition: all 0.2s ease;
}
input:focus, select:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
button { background: var(--accent-blue); color: white; cursor: pointer; font-weight: 500; border: none; }
button:hover:not(:disabled) { background: #2563eb; transform: translateY(-1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary { background: var(--bg-secondary) !important; border: 1px solid var(--border-color) !important; color: var(--text-primary) !important; }
.btn-secondary:hover { border-color: var(--accent-blue) !important; color: var(--accent-blue) !important; }
.danger { background: var(--accent-red) !important; border-color: var(--accent-red) !important;}
.danger:hover { background: #dc2626 !important; }
.btn-primary {
    display: inline-block; padding: 12px 24px; background: var(--accent-blue);
    color: white; text-decoration: none; border-radius: 8px; font-weight: 500; transition: all 0.2s ease;
}
.btn-primary:hover { background: #2563eb; transform: translateY(-2px); }

/* --- Tables --- */
table { 
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--bg-card); border-radius: 12px;
    border: 1px solid var(--border-color); overflow: visible;
}
thead { background: var(--bg-secondary); }
th { 
    padding: 16px 12px; text-align: left; font-weight: 600; font-size: 12px;
    color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid var(--border-color);
    cursor: pointer; position: relative; user-select: none;
}
td { padding: 16px 12px; font-size: 14px; border-bottom: 1px solid var(--border-color); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s ease; }
tbody tr:hover { background: var(--bg-hover); }

/* --- Badges --- */
.currency-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--accent-blue); color: white; }
.currency-usd { background: var(--accent-green); }
.asset-type-badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; border: 1px solid transparent; }
.asset-type-stock { background: rgba(59, 130, 246, 0.2); color: #3b82f6; border-color: rgba(59, 130, 246, 0.3); }
.asset-type-etf { background: rgba(139, 92, 246, 0.2); color: #8b5cf6; border-color: rgba(139, 92, 246, 0.3); }
.asset-type-crypto { background: rgba(245, 158, 11, 0.2); color: #f59e0b; border-color: rgba(245, 158, 11, 0.3); }
.broker-badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 11px; background: var(--bg-secondary); border: 1px solid var(--border-color); }

/* --- Modals --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 14, 39, 0.85); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000; opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-content {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 16px; width: 100%; max-width: 420px;
    box-shadow: var(--shadow-lg); overflow: hidden; animation: modalPop 0.3s ease;
}
@keyframes modalPop { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border-color); }
.modal-header h3 { font-size: 18px; font-weight: 600; margin: 0; }
.modal-close { background: transparent; border: none; font-size: 1.5em; color: var(--text-muted); cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 24px; }

/* --- Utilities (Text Colors) --- */
.positive { color: var(--accent-green) !important; }
.negative { color: var(--accent-red) !important; }
.neutral { color: var(--text-secondary) !important; }
.unavailable { color: var(--text-muted); font-style: italic; }

/* =========================================
   PORTFOLIO SUMMARY CARDS (C'est ici que ça manquait)
   ========================================= */
.portfolio-summary-enhanced {
    margin: 24px 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.summary-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.summary-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.summary-card-primary {
    border: 1px solid rgba(59, 130, 246, 0.3);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.summary-card-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.summary-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.summary-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.meta-large { font-size: 18px; font-weight: 700; }
.meta-info { font-size: 13px; color: var(--text-muted); }

/* --- Petites stats en ligne en dessous --- */
.summary-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap; /* Important pour le responsive */
}

.stat-item {
    flex: 1;
    min-width: 150px; /* Pour éviter qu'ils soient trop écrasés */
    background: var(--bg-card);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: all 0.2s ease;
}

.stat-item:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-blue);
}

.stat-positive { color: var(--accent-green) !important; }
.stat-negative { color: var(--accent-red) !important; }

/* Responsive pour les stats */
@media (max-width: 768px) {
    .summary-grid { grid-template-columns: 1fr; }
    .summary-stats { flex-direction: column; }
}