/* CyberSolution Dashboard - Modern Design */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --accent: #0ea5e9;
    --navy: #0f172a;
    --navy-light: #1e293b;
    --slate: #334155;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --bg: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

h1:focus { outline: none; }

/* ===== Navbar ===== */
.navbar-cyber {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 0.6rem 0;
    backdrop-filter: blur(10px);
}

.navbar-cyber .navbar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.3px;
    color: white !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-cyber .brand-icon {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.navbar-cyber .brand-icon img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.navbar-cyber .nav-link {
    color: rgba(255,255,255,0.6) !important;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.45rem 0.85rem !important;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    margin: 0 2px;
}

.navbar-cyber .nav-link:hover {
    color: rgba(255,255,255,0.9) !important;
    background: rgba(255,255,255,0.08);
}

.navbar-cyber .nav-link.active {
    color: white !important;
    background: rgba(255,255,255,0.12);
}

.navbar-cyber .btn-outline-light {
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.8);
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.85rem;
}

.navbar-cyber .btn-outline-light:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
    color: white;
}

/* ===== Dashboard Header ===== */
.dashboard-header {
    background: linear-gradient(135deg, var(--navy) 0%, var(--slate) 100%);
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.dashboard-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(37,99,235,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.dashboard-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}

.dashboard-header p {
    color: rgba(255,255,255,0.6);
    font-size: 0.875rem;
    margin-bottom: 0;
}

.dashboard-header .search-box {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    color: white;
    transition: all var(--transition);
}

.dashboard-header .search-box:focus-within {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.25);
}

.dashboard-header .search-box input {
    background: transparent !important;
    border: none !important;
    color: white !important;
    font-size: 0.875rem;
}

.dashboard-header .search-box input::placeholder {
    color: rgba(255,255,255,0.4);
}

.dashboard-header .search-box .input-group-text {
    background: transparent !important;
    border: none !important;
    color: rgba(255,255,255,0.4);
}

.dashboard-header .btn-refresh {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.45rem 1rem;
    transition: all var(--transition);
}

.dashboard-header .btn-refresh:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.25);
    color: white;
}

.dashboard-header .btn-export {
    background: var(--primary);
    border: none;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.45rem 1rem;
    transition: all var(--transition);
}

.dashboard-header .btn-export:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

/* ===== Stat Cards ===== */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    font-size: 1.1rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* ===== Section Headers ===== */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.section-title h5 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin: 0;
}

.section-title .section-line {
    flex: 1;
    height: 1px;
    background: var(--border);
}

.section-title .section-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* ===== Module Cards ===== */
.module-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    overflow: hidden;
}

.module-card.clickable {
    cursor: pointer;
}

.module-card.clickable:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

.module-card .card-header {
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.module-card .card-header .module-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.6rem;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.module-card .card-header .badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.3em 0.65em;
    border-radius: 6px;
}

.module-card .card-body {
    padding: 0;
}

/* ===== Quick Stats in Module Cards ===== */
.quick-stat {
    display: flex;
    align-items: center;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background var(--transition);
}

.quick-stat:last-child {
    border-bottom: none;
}

.module-card.clickable:hover .quick-stat:hover {
    background: var(--surface-hover);
}

.quick-stat-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.quick-stat .fw-semibold {
    font-size: 0.85rem;
    color: var(--text);
}

.quick-stat small {
    font-size: 0.72rem;
    color: var(--text-light);
}

.quick-stat .badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3em 0.6em;
    border-radius: 6px;
}

/* ===== Charts Section ===== */
.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition);
}

.chart-card:hover {
    box-shadow: var(--shadow-md);
}

.chart-card .card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-card .card-header i {
    color: var(--primary);
    font-size: 1rem;
}

.chart-card .card-body {
    padding: 1rem;
}

/* ===== Spin Animation ===== */
.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== Chargement global ===== */
/* Barre fine indeterminee en haut de la fenetre pendant tout chargement (initial + refresh). */
.global-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 2000;
    background: var(--primary-light);
    overflow: hidden;
}

.global-progress::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -40%;
    width: 40%;
    background: var(--primary);
    animation: global-progress-slide 1.1s ease-in-out infinite;
}

@keyframes global-progress-slide {
    0% { left: -40%; }
    100% { left: 100%; }
}

/* Voile plein-ecran affiche uniquement au premier chargement. */
.dashboard-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 1900;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Detail Panel (Modal) ===== */
.detail-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15,23,42,0.6);
    backdrop-filter: blur(4px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.detail-panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    animation: slideUp 0.2s ease-out;
    overflow: hidden;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.detail-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: white;
}

.detail-panel-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-panel-header .btn-close-panel {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--transition);
}

.detail-panel-header .btn-close-panel:hover {
    background: rgba(255,255,255,0.2);
}

.detail-panel-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.detail-panel-actions .btn-export-detail {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.detail-panel-actions .btn-export-detail:hover {
    background: rgba(255,255,255,0.2);
}

.detail-panel-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.detail-panel-body .card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.detail-panel-body .card-header {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.6rem 0.85rem;
}

.detail-panel-body .list-group-item {
    border-color: #f1f5f9;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
}

/* ===== Error UI ===== */
#blazor-error-ui {
    background: var(--danger);
    color: white;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem;
    text-align: center;
    display: none;
    z-index: 9999;
    font-size: 0.875rem;
}

#blazor-error-ui .reload {
    color: white;
    text-decoration: underline;
    margin-left: 1rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    margin-left: 1rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: var(--radius-sm);
}

.blazor-error-boundary::after {
    content: "Une erreur s'est produite."
}

/* ===== Orange color for High severity ===== */
.bg-orange { background-color: #ea580c !important; color: white; }
.text-orange { color: #ea580c !important; }
.progress-bar.bg-orange { background-color: #ea580c !important; }

/* ===== Score Circle ===== */
.score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 auto;
    color: white;
}

.score-excellent { background: linear-gradient(135deg, #059669, #10b981); }
.score-good { background: linear-gradient(135deg, #2563eb, #0ea5e9); }
.score-warning { background: linear-gradient(135deg, #d97706, #f59e0b); }
.score-critical { background: linear-gradient(135deg, #dc2626, #ef4444); }

/* ===== Recommendation Cards ===== */
.rec-card {
    transition: box-shadow var(--transition);
    overflow: hidden;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
}

.rec-card:hover {
    box-shadow: var(--shadow-md) !important;
}

.rec-header {
    cursor: pointer;
    transition: background-color 0.1s;
}

.rec-header:hover {
    background-color: var(--surface-hover);
}

.severity-indicator {
    width: 4px;
    height: 48px;
    border-radius: 4px;
    flex-shrink: 0;
}

.sev-critical { background: var(--danger); }
.sev-high { background: #ea580c; }
.sev-medium { background: var(--warning); }
.sev-low { background: var(--info); }

.rec-detail {
    background: #f8fafc;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 1000px; }
}

.remediation-steps {
    padding-left: 1.25rem;
}

.remediation-steps li {
    padding: 0.15rem 0;
    color: #495057;
    font-size: 0.85rem;
}

.remediation-steps li::marker {
    color: var(--text-muted);
    font-weight: 600;
}

/* ===== Alert Styling ===== */
.alert {
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.875rem;
}

/* ===== Azure Error Badge ===== */
.module-card.border-warning {
    border-color: var(--warning) !important;
}

/* ===== Footer ===== */
.dashboard-footer {
    color: var(--text-light);
    font-size: 0.78rem;
    padding: 1rem 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .dashboard-header {
        padding: 1.25rem;
    }
    .dashboard-header h1 {
        font-size: 1.25rem;
    }
    .detail-panel {
        width: 95%;
        max-height: 90vh;
    }
}

/* ===== Loading State ===== */
.loading-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Export Toast ===== */
.export-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--navy);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    animation: toastIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Elements concernes (recommandations) ===== */
.affected-items {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    max-height: 260px;
    overflow-y: auto;
}

.affected-items li {
    color: #475569;
}
