/* Stile Personalizzato Dashboard SecureNet Cloud */

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-light: #f0f6ff;
    --card-bg: rgba(255, 255, 255, 0.82);
    --card-border: rgba(0, 150, 220, 0.12);
    --text-primary: #1a2a3a;
    --text-muted: #6b87a5;
    --celeste: #00a8e8;
    --celeste-hover: #0072c6;
    --celeste-glow: rgba(0, 168, 232, 0.18);
    --critical-border: #ef4444;
    --critical-glow: rgba(239, 68, 68, 0.18);
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: auto;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(0, 168, 232, 0.07) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 114, 200, 0.06) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Scrollbar Style */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #e8f2fb;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 168, 232, 0.25);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--celeste);
}

/* Layout */
.wrapper {
    display: flex;
    align-items: stretch;
    width: 100%;
}

/* Sidebar Navigation */
.sidebar {
    min-width: 260px;
    max-width: 260px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid var(--card-border);
    color: var(--text-primary);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar-header {
    padding: 2.2rem 1.5rem 1.8rem;
    border-bottom: 1px solid rgba(0, 150, 220, 0.08);
}

.sidebar .logo-text {
    background: linear-gradient(135deg, #00a8e8, #0072c6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.sidebar ul.components {
    padding: 1.5rem 0;
}

.sidebar ul li {
    padding: 0.2rem 1rem;
    list-style-type: none;
}

.sidebar ul li a {
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.25s;
}

.sidebar ul li a:hover {
    color: var(--celeste-hover);
    background: rgba(0, 168, 232, 0.06);
}

.sidebar ul li.active > a {
    color: #ffffff;
    background: linear-gradient(135deg, var(--celeste), #0072c6);
    box-shadow: 0 4px 12px rgba(0, 168, 232, 0.25);
}

/* Page Content */
#content {
    width: calc(100% - 260px);
    flex-grow: 1;
    padding: 1.8rem 2rem;
    min-height: 100vh;
}



/* Logout button — top right */
.btn-logout-top {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.42rem 1rem;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid rgba(239, 68, 68, 0.18);
    color: #ef4444;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.25s;
    white-space: nowrap;
}

.btn-logout-top:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.22);
}

/* Table scroll container — riempie tutto lo spazio disponibile nella card */
.table-scroll-container {
    flex: 1;
    overflow-y: auto;
    border-radius: 10px;
    min-height: 0; /* necessario per flex: 1 in un flex container */
}

.table-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.table-scroll-container::-webkit-scrollbar-track {
    background: #f0f6ff;
    border-radius: 10px;
}

.table-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(0, 168, 232, 0.3);
    border-radius: 10px;
}

.table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: var(--celeste);
}

/* Sticky thead inside scroll container */
.table-scroll-container .table-custom thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #f0f7ff !important;
}



.card-glass {
    background: var(--card-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    box-shadow: 0 4px 18px rgba(0, 100, 180, 0.08);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.card-glass:hover {
    transform: translateY(-3px);
    border-color: rgba(0, 168, 232, 0.22);
    box-shadow: 0 10px 28px rgba(0, 168, 232, 0.10);
}

/* Stats Cards — compatti */
.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0;
    color: var(--text-primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.stat-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--celeste), #0072c6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Interactive Table */
.table-responsive {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--card-border);
}

.table-custom {
    margin-bottom: 0;
    background-color: transparent;
    color: var(--text-primary);
}

.table-custom th {
    background-color: rgba(0, 168, 232, 0.05) !important;
    color: var(--text-muted) !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 1px;
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid var(--card-border) !important;
}

.table-custom td {
    padding: 0.55rem 0.8rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 100, 180, 0.05);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.table-custom tbody tr {
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Row danger critical: bordo rosso SOLO per Critico */
.danger-critical {
    position: relative;
    box-shadow:
        inset 0 0 0 2px var(--critical-border),
        0 4px 15px var(--critical-glow) !important;
    background-color: rgba(239, 68, 68, 0.02) !important;
}

.danger-critical td {
    border-bottom: 1px solid var(--critical-border);
}

.danger-critical td:first-child {
    border-left: 2px solid var(--critical-border);
}

.danger-critical td:last-child {
    border-right: 2px solid var(--critical-border);
}

/* Testo pericolo — solo colore, nessuno sfondo */
.pericolo-critico {
    color: #dc2626;
    font-weight: 700;
}

.pericolo-alto {
    color: #dc2626;
}

.pericolo-medio {
    color: #ca8a04;
}

.pericolo-basso {
    color: #16a34a;
}

/* Status Badges */
.badge-custom {
    padding: 0.45em 0.85em;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

.badge-bloccato {
    background-color: rgba(16, 185, 129, 0.12) !important;
    color: #059669 !important;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-rilevato {
    background-color: rgba(202, 138, 4, 0.12) !important;
    color: #b45309 !important;
    border: 1px solid rgba(202, 138, 4, 0.2);
}

.badge-isolato {
    background-color: rgba(99, 102, 241, 0.12) !important;
    color: #4f46e5 !important;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.badge-monitorato {
    background-color: rgba(14, 165, 233, 0.12) !important;
    color: #0284c7 !important;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

/* CSS Pie / Conic Chart */
.chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.css-conic-chart {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 100, 180, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    transition: all 0.5s ease;
}

/* Chart Center Ring (donut) */
.css-conic-chart::after {
    content: '';
    position: absolute;
    width: 130px;
    height: 130px;
    background: #ffffff;
    border-radius: 50%;
    z-index: 2;
    border: 1px solid var(--card-border);
}

.chart-center-text {
    position: absolute;
    z-index: 3;
    text-align: center;
}

.chart-center-text .percent {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    line-height: 1;
}

.chart-center-text .label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Chart Legend */
.chart-legend {
    display: flex;
    justify-content: space-around;
    width: 100%;
    padding-top: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    margin-right: 8px;
}

.color-blocked {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.color-detected {
    background: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

/* AI Security Consultant Panel */
.ai-consultant-card {
    border: 1px solid rgba(0, 168, 232, 0.2);
    box-shadow: 0 6px 24px rgba(0, 168, 232, 0.06);
}

.ai-header-pill {
    background: linear-gradient(135deg, rgba(0, 168, 232, 0.1), rgba(0, 114, 198, 0.1));
    border: 1px solid rgba(0, 168, 232, 0.25);
    color: var(--celeste);
    border-radius: 30px;
    padding: 0.4rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.ai-advice-box {
    background: rgba(0, 168, 232, 0.04);
    border: 1px dashed rgba(0, 168, 232, 0.18);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.2rem;
}

.btn-pdf {
    background: rgba(0, 100, 180, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(0, 100, 180, 0.15);
    border-radius: 10px;
    padding: 0.6rem 1.2rem;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-pdf:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
    box-shadow: 0 8px 16px rgba(239, 68, 68, 0.22);
}

/* Prompt Console Area */
.prompt-area {
    background: rgba(240, 248, 255, 0.7);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
}

.prompt-textarea {
    background: #ffffff;
    border: 1px solid rgba(0, 168, 232, 0.18);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    border-radius: 12px;
    padding: 1rem;
    resize: none;
    transition: all 0.3s;
}

.prompt-textarea:focus {
    background: #ffffff;
    border-color: var(--celeste);
    box-shadow: 0 0 12px rgba(0, 168, 232, 0.15);
    color: var(--text-primary);
}

.console-output {
    background: #0d1b2a;
    border: 1px solid rgba(0, 168, 232, 0.12);
    border-radius: 12px;
    padding: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: #c8e6ff;
    min-height: 180px;
    max-height: 350px;
    overflow-y: auto;
    line-height: 1.6;
}

.console-cursor {
    display: inline-block;
    width: 8px;
    height: 15px;
    background-color: var(--celeste);
    animation: blink 1s step-end infinite;
    margin-left: 4px;
    vertical-align: middle;
}

@keyframes blink {
    from, to { background-color: transparent }
    50% { background-color: var(--celeste) }
}

/* IP Badge in Console */
.ip-badge {
    background: rgba(0, 168, 232, 0.10);
    border: 1px solid rgba(0, 168, 232, 0.22);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    color: var(--celeste);
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-send-ai {
    background: linear-gradient(135deg, var(--celeste), #0072c6);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-send-ai:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 168, 232, 0.3);
    color: #fff;
}

.btn-send-ai:disabled {
    background: rgba(0, 100, 180, 0.12);
    color: var(--text-muted);
    transform: none;
    box-shadow: none;
}

/* Responsive Overrides */
@media (max-width: 991.98px) {
    .wrapper {
        flex-direction: column;
    }
    #sidebar {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid rgba(0, 168, 232, 0.13);
    }
    .sidebar-header {
        padding: 1.2rem 1.5rem 0.8rem;
        text-align: center;
    }
    .sidebar ul.components {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 0.5rem 1rem;
        margin: 0;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar ul.components::-webkit-scrollbar {
        display: none; /* nasconde scrollbar per estetica */
    }
    .sidebar ul li {
        padding: 0 0.3rem;
        white-space: nowrap;
    }
    .sidebar ul li a {
        padding: 0.5rem 0.8rem;
        font-size: 0.82rem;
    }
    #content {
        width: 100%;
        padding: 1.2rem 1rem;
    }
}

@media (max-width: 576px) {
    #content {
        padding: 1rem 0.6rem;
    }
    .chart-legend {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding-left: 1rem;
    }
}
