/* --- Premium Global CSS Variables & Base Styles --- */
:root {
    --bg-gradient: linear-gradient(135deg, #070913 0%, #0d0f22 50%, #15112e 100%);
    --panel-bg: rgba(22, 25, 49, 0.55);
    --sidebar-bg: rgba(12, 14, 30, 0.85);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(124, 77, 255, 0.4);
    
    --primary: #7c4dff;
    --primary-glow: rgba(124, 77, 255, 0.35);
    --secondary: #00e5ff;
    --secondary-glow: rgba(0, 229, 255, 0.25);
    
    --text-main: #f1f3fa;
    --text-muted: #8b92b6;
    --text-dark: #121629;
    
    /* Risk Status Colors */
    --color-clean: #00e676;
    --bg-clean: rgba(0, 230, 118, 0.12);
    --color-suspicious: #ff9100;
    --bg-suspicious: rgba(255, 145, 0, 0.12);
    --color-malicious: #ff1744;
    --bg-malicious: rgba(255, 23, 68, 0.12);
    
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    scrollbar-width: thin;
    scrollbar-color: rgba(124, 77, 255, 0.3) rgba(0, 0, 0, 0.1);
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, .logo-text {
    font-family: 'Outfit', sans-serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(124, 77, 255, 0.3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* --- App Layout --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar Styling --- */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    z-index: 10;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 3rem;
}

.logo-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.logo-text {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.logo-text span {
    color: var(--secondary);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    flex-grow: 1;
}

.nav-item {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
    transition: var(--transition);
}

.nav-item i {
    font-size: 1.1rem;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(124, 77, 255, 0.2) 0%, rgba(0, 229, 255, 0.05) 100%);
    border: 1px solid rgba(124, 77, 255, 0.3);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: var(--color-clean);
    box-shadow: 0 0 8px var(--color-clean);
}

.status-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --- Main Content Panel --- */
.main-content {
    flex-grow: 1;
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-height: 100vh;
    overflow-y: auto;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

#page-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, #b9bfe3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-secondary {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.key-status-bubble {
    background: rgba(0, 230, 118, 0.06);
    border: 1px solid rgba(0, 230, 118, 0.2);
    padding: 0.6rem 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

/* --- Tab Content Control --- */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

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

/* --- Stat Cards Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

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

.stat-icon-wrapper.blue {
    background: rgba(0, 229, 255, 0.1);
    color: var(--secondary);
    border: 1px solid rgba(0, 229, 255, 0.2);
}

.stat-icon-wrapper.purple {
    background: rgba(124, 77, 255, 0.1);
    color: var(--primary);
    border: 1px solid rgba(124, 77, 255, 0.2);
}

.stat-icon-wrapper.red {
    background: rgba(255, 23, 68, 0.1);
    color: var(--color-malicious);
    border: 1px solid rgba(255, 23, 68, 0.2);
}

.stat-icon-wrapper.green {
    background: rgba(0, 230, 118, 0.1);
    color: var(--color-clean);
    border: 1px solid rgba(0, 230, 118, 0.2);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
}

/* Pulse Animation */
.animate-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 23, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 23, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 23, 68, 0); }
}

/* --- Panel Layouts --- */
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 2rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.panel h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, #ccd2f8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.panel-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.dashboard-panel-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
}

@media (max-width: 992px) {
    .dashboard-panel-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Upload Panel Style --- */
.drop-zone {
    border: 2px dashed rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 3rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: var(--transition);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(124, 77, 255, 0.03);
}

.drop-icon {
    font-size: 3rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.drop-zone:hover .drop-icon {
    color: var(--primary);
    transform: scale(1.1);
}

.drop-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.drop-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #b388ff 100%);
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 25px rgba(124, 77, 255, 0.6);
    transform: translateY(-2px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: rgba(255, 23, 68, 0.1);
    color: var(--color-malicious);
    border: 1px solid rgba(255, 23, 68, 0.2);
}

.btn-danger:hover:not(:disabled) {
    background: var(--color-malicious);
    color: #fff;
    box-shadow: 0 0 12px rgba(255, 23, 68, 0.3);
    transform: translateY(-2px);
}

.file-details-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 1.2rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.5rem;
    animation: slideUp 0.3s ease;
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-meta-icon {
    font-size: 2rem;
    color: var(--secondary);
}

.file-meta h4 {
    font-size: 0.95rem;
    font-weight: 600;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* --- Live Scan Panel --- */
.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.scan-status-badge {
    background: rgba(0, 229, 255, 0.1);
    color: var(--secondary);
    border: 1px solid rgba(0, 229, 255, 0.25);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    animation: glow-pulse-cyan 1.5s infinite;
}

@keyframes glow-pulse-cyan {
    0% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.3); }
    70% { box-shadow: 0 0 0 8px rgba(0, 229, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0); }
}

.live-scan-idle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 250px;
    text-align: center;
    gap: 1rem;
}

.scan-idle-icon {
    font-size: 3.5rem;
    color: rgba(255, 255, 255, 0.05);
}

.live-scan-active {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.progress-ring-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.35s;
    transform-origin: 50% 50%;
}

.progress-text-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.percent-val {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
}

.count-val {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.active-scan-meta {
    width: 100%;
}

#active-scan-filename {
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-log-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
}

.live-log-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.6rem;
}

.live-logs {
    height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-family: monospace;
    font-size: 0.85rem;
}

.log-entry {
    animation: logFadeIn 0.2s ease;
    line-height: 1.4;
}

.log-entry.system { color: var(--text-muted); }
.log-entry.checking { color: var(--secondary); }
.log-entry.success { color: var(--color-clean); }
.log-entry.warning { color: var(--color-suspicious); }
.log-entry.danger { color: var(--color-malicious); }

@keyframes logFadeIn {
    from { opacity: 0; transform: translateX(-5px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- History & Table Styling --- */
.history-controls {
    padding: 1.5rem;
}

.search-and-filters {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 0.8fr 0.8fr 1fr;
    gap: 1.2rem;
    align-items: center;
}

@media (max-width: 768px) {
    .search-and-filters {
        grid-template-columns: 1fr;
    }
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

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

.form-control {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
    width: 100%;
}

.form-control:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

select.form-control option {
    background-color: #0c0e1e;
    color: #fff;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-icon-wrapper .form-control {
    padding-left: 2.5rem;
}

.flex-align-end {
    align-self: flex-end;
}

/* Styled Results Table */
.table-panel {
    padding: 1.5rem;
}

.table-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-header-row h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.results-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.03);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.styled-table th {
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem 1.2rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}

.styled-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

.styled-table tbody tr {
    transition: var(--transition);
}

.styled-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges styling */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.clean {
    color: var(--color-clean);
    background: var(--bg-clean);
    border: 1px solid rgba(0, 230, 118, 0.25);
}

.badge.suspicious {
    color: var(--color-suspicious);
    background: var(--bg-suspicious);
    border: 1px solid rgba(255, 145, 0, 0.25);
}

.badge.malicious {
    color: var(--color-malicious);
    background: var(--bg-malicious);
    border: 1px solid rgba(255, 23, 68, 0.25);
    box-shadow: 0 0 10px rgba(255, 23, 68, 0.1);
}

.badge.pending {
    color: var(--secondary);
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.25);
}

/* Country Flag */
.country-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.flag-placeholder {
    width: 20px;
    height: 14px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
}

.btn-action-view {
    background: rgba(124, 77, 255, 0.1);
    color: var(--primary);
    border: 1px solid rgba(124, 77, 255, 0.2);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action-view:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* --- API Keys Panel Grid --- */
.keys-grid {
    display: grid;
    grid-template-columns: 1fr 1.8fr;
    gap: 2rem;
}

@media (max-width: 992px) {
    .keys-grid {
        grid-template-columns: 1fr;
    }
}

.key-pool-table-wrapper {
    overflow-x: auto;
}

/* API Key Status badges */
.key-status {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.key-status.untested { color: var(--text-muted); }
.key-status.active { color: var(--color-clean); }
.key-status.invalid { color: var(--color-malicious); }
.key-status.rate_limited { color: var(--color-suspicious); }

/* Switch Toggle Box */
.switch-wrapper {
    display: flex;
    align-items: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.1);
    transition: .3s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: rgba(124, 77, 255, 0.2);
    border-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(22px);
    background-color: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

.key-actions-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.btn-icon-test {
    background: rgba(0, 229, 255, 0.1);
    color: var(--secondary);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon-test:hover {
    background: var(--secondary);
    color: var(--text-dark);
}

.btn-icon-delete {
    background: rgba(255, 23, 68, 0.1);
    color: var(--color-malicious);
    border: 1px solid rgba(255, 23, 68, 0.2);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon-delete:hover {
    background: var(--color-malicious);
    color: #fff;
}

/* --- Detailed Modal Dialog --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(3, 4, 11, 0.8);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 2rem 0;
    animation: fadeIn 0.3s ease;
}

.modal-container {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 90%;
    max-width: 650px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    position: relative;
    margin: auto;
    animation: slideUp 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close-btn:hover {
    color: #fff;
    transform: scale(1.1);
}

.modal-pdf-btn {
    position: absolute;
    top: 1.5rem;
    right: 3.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-pdf-btn:hover {
    color: var(--secondary);
    transform: scale(1.1);
}

.modal-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modal-title-row h2 {
    font-size: 2rem;
}

.severity-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
}

.severity-badge.clean { color: var(--color-clean); background: var(--bg-clean); border: 1px solid rgba(0, 230, 118, 0.3); }
.severity-badge.suspicious { color: var(--color-suspicious); background: var(--bg-suspicious); border: 1px solid rgba(255, 145, 0, 0.3); }
.severity-badge.high-risk { color: var(--color-malicious); background: var(--bg-malicious); border: 1px solid rgba(255, 23, 68, 0.3); box-shadow: 0 0 12px rgba(255, 23, 68, 0.2); }

.modal-body-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
}

@media (max-width: 576px) {
    .modal-body-grid {
        grid-template-columns: 1fr;
    }
}

.modal-subpanel {
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    padding: 1.2rem;
    border-radius: 12px;
}

.modal-subpanel h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--secondary);
}

.meta-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-size: 0.9rem;
}

.meta-list li {
    display: flex;
    justify-content: space-between;
}

.meta-list li strong {
    color: var(--text-muted);
}

.score-display-row {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.score-circle-wrapper {
    position: relative;
    width: 70px;
    height: 70px;
}

.score-circle-wrapper svg {
    transform: rotate(-90deg);
}

.score-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1rem;
    font-weight: 700;
}

.score-label-meta h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.vt-stat-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.vt-stat-bar-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.vt-bar-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 500;
}

.vt-bar-track {
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
}

.vt-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease-out;
}

.bg-danger { background-color: var(--color-malicious); }
.bg-success { background-color: var(--color-clean); }

/* --- Notification Toast --- */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    z-index: 1000;
}

.toast {
    background: rgba(20, 24, 46, 0.95);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: #fff;
    min-width: 280px;
    animation: toastSlideIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    transition: var(--transition);
}

.toast.success { border-left: 4px solid var(--color-clean); }
.toast.error { border-left: 4px solid var(--color-malicious); }
.toast.info { border-left: 4px solid var(--secondary); }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Helper utilities */
.d-none { display: none !important; }
.text-center { text-align: center; }
.text-success { color: var(--color-clean); }
.text-danger { color: var(--color-malicious); }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-5 { padding-top: 3rem; padding-bottom: 3rem; }
.fs-2 { font-size: 1.5rem; }
.w-100 { width: 100%; }

/* --- Upload Panel Tab Switcher Styles --- */
.panel-tabs {
    display: flex;
    gap: 0.6rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.8rem;
    margin-bottom: 1.5rem;
}

.panel-tab {
    background: transparent;
    border: 1px solid transparent;
    outline: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.panel-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.panel-tab.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(124, 77, 255, 0.2) 0%, rgba(0, 229, 255, 0.05) 100%);
    border: 1px solid rgba(124, 77, 255, 0.3);
    box-shadow: 0 4px 12px rgba(124, 77, 255, 0.15);
}

.scan-view-content {
    animation: fadeIn 0.3s ease;
}

/* --- Screen Responsive overrides for IP Details Modal --- */
@media (max-width: 768px) {
    .modal-container {
        padding: 1.5rem !important;
        width: 95% !important;
    }
    
    .ipqs-details-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .ipqs-quick-table {
        gap: 1rem !important;
        padding: 0.6rem 0.8rem !important;
        font-size: 0.85rem !important;
        width: 100% !important;
        justify-content: space-around !important;
    }
}

@media (max-width: 576px) {
    .modal-container {
        padding: 1.2rem 1rem !important;
    }
    
    .modal-header-flex {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }
    
    .ipqs-quick-table {
        flex-wrap: wrap !important;
        gap: 0.8rem !important;
        width: 100% !important;
        justify-content: center !important;
    }
    
    .ipqs-quick-table .quick-col {
        flex-basis: 28% !important;
        margin-bottom: 0.2rem;
    }

    .ipqs-details-grid {
        grid-template-columns: 1fr !important;
    }
    
    .modal-title-row h2 {
        font-size: 1.5rem !important;
    }
    
    #modal-ip {
        font-size: 1.8rem !important;
    }
}

/* --- Print PDF Specific Override Layouts --- */
.printing-pdf-container {
    width: 780px !important;
    max-width: 780px !important;
    background: #0d0f22 !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    z-index: 1 !important;
    box-shadow: none !important;
    transform: none !important;
    padding: 2rem !important;
    border-radius: 0px !important;
    border: none !important;
}

.printing-pdf-container .modal-body-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5rem !important;
}

.printing-pdf-container #modal-ipqs-panel .ipqs-details-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1rem !important;
}

/* --- Login & Registration CSS --- */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gradient);
    z-index: 9999;
    padding: 1.5rem;
    overflow-y: auto;
}

.login-card {
    background: rgba(18, 20, 43, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 
                0 0 40px rgba(124, 77, 255, 0.1);
    animation: loginCardFadeIn 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo-icon {
    font-size: 2.8rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px var(--primary-glow));
    margin-bottom: 0.8rem;
}

.login-header h2 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 0.2rem;
}

.login-header h2 span {
    color: var(--secondary);
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.login-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.35rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.login-tab {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.7rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.login-tab:hover {
    color: var(--text-main);
}

.login-tab.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, #b388ff 100%);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.login-form-content {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    animation: fadeIn 0.3s ease;
}

.form-footer {
    display: flex;
    justify-content: center;
    font-size: 0.9rem;
}

.form-footer a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.form-footer a:hover {
    color: #fff;
    text-shadow: 0 0 8px var(--secondary-glow);
}

.register-note {
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.4;
    color: var(--text-muted);
}

/* --- User settings badges/tables --- */
.users-table td {
    padding: 0.8rem 1rem;
}
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.role-badge.superuser {
    background: rgba(124, 77, 255, 0.12);
    color: #b388ff;
    border: 1px solid rgba(124, 77, 255, 0.3);
}
.role-badge.admin {
    background: rgba(0, 229, 255, 0.12);
    color: var(--secondary);
    border: 1px solid rgba(0, 229, 255, 0.3);
}
.role-badge.user {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
.role-badge.manager {
    background: rgba(255, 171, 0, 0.12);
    color: #ffd740;
    border: 1px solid rgba(255, 171, 0, 0.3);
}
.role-badge.analyst {
    background: rgba(0, 230, 118, 0.12);
    color: #69f0ae;
    border: 1px solid rgba(0, 230, 118, 0.3);
}
.role-badge.viewer {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.role-select {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}
.role-select:hover {
    background: rgba(255, 255, 255, 0.1);
}
.role-select.superuser {
    background: rgba(124, 77, 255, 0.12);
    color: #b388ff;
    border: 1px solid rgba(124, 77, 255, 0.3);
}
.role-select.admin {
    background: rgba(0, 229, 255, 0.12);
    color: var(--secondary);
    border: 1px solid rgba(0, 229, 255, 0.3);
}
.role-select.user {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
.role-select.manager {
    background: rgba(255, 171, 0, 0.12);
    color: #ffd740;
    border: 1px solid rgba(255, 171, 0, 0.3);
}
.role-select.analyst {
    background: rgba(0, 230, 118, 0.12);
    color: #69f0ae;
    border: 1px solid rgba(0, 230, 118, 0.3);
}
.role-select.viewer {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.org-select {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}
.org-select:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.user-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.user-status-badge.active {
    background: rgba(0, 230, 118, 0.12);
    color: var(--color-clean);
    border: 1px solid rgba(0, 230, 118, 0.3);
}
.user-status-badge.pending {
    background: rgba(255, 145, 0, 0.12);
    color: var(--color-suspicious);
    border: 1px solid rgba(255, 145, 0, 0.3);
}

/* ==========================================
   Reporting Page Styles
   ========================================== */
.reporting-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
}
@media (max-width: 992px) {
    .reporting-layout {
        grid-template-columns: 1fr;
    }
}

/* Category Grid */
.report-categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
    padding: 0.3rem;
}
@media (max-width: 768px) {
    .report-categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Category Chip */
.category-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    font-size: 0.82rem;
}
.category-chip:hover {
    background: rgba(124, 77, 255, 0.08);
    border-color: rgba(124, 77, 255, 0.25);
}
.category-chip.selected {
    background: rgba(124, 77, 255, 0.15);
    border-color: rgba(124, 77, 255, 0.5);
    color: #c4a6ff;
}
.category-chip input[type="checkbox"] {
    accent-color: #7c4dff;
    width: 15px;
    height: 15px;
    cursor: pointer;
}
.category-chip .cat-id {
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    min-width: 22px;
    text-align: center;
}
.category-chip.selected .cat-id {
    background: rgba(124, 77, 255, 0.3);
    color: #fff;
}
.category-chip .cat-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Report Status Badges */
.report-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.report-status.success {
    background: rgba(0, 230, 118, 0.12);
    color: #00e676;
    border: 1px solid rgba(0, 230, 118, 0.3);
}
.report-status.failed {
    background: rgba(255, 23, 68, 0.12);
    color: #ff1744;
    border: 1px solid rgba(255, 23, 68, 0.3);
}
.report-status.rate_limited {
    background: rgba(255, 145, 0, 0.12);
    color: #ff9100;
    border: 1px solid rgba(255, 145, 0, 0.3);
}
.report-status.pending {
    background: rgba(124, 77, 255, 0.12);
    color: #7c4dff;
    border: 1px solid rgba(124, 77, 255, 0.3);
}

/* Category tags in history table */
.cat-tag {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    background: rgba(0, 229, 255, 0.1);
    color: #00e5ff;
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    margin: 0.1rem;
}

/* Report comment truncation */
.report-comment-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}
.report-comment-cell:hover {
    white-space: normal;
    overflow: visible;
}

/* Preset buttons active state */

.report-preset-btn.active {
    background: rgba(124, 77, 255, 0.15) !important;
    border-color: rgba(124, 77, 255, 0.4) !important;
    color: #c4a6ff !important;
}

/* --- Map Time Filter Chips --- */
.map-time-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #8b92b6;
    border-radius: 20px;
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}
.map-time-chip:hover {
    background: rgba(124, 77, 255, 0.15);
    border-color: rgba(124, 77, 255, 0.35);
    color: #c4a6ff;
}
.map-time-chip.active {
    background: rgba(124, 77, 255, 0.25);
    border-color: rgba(124, 77, 255, 0.6);
    color: #c4a6ff;
    font-weight: 600;
    box-shadow: 0 0 10px rgba(124, 77, 255, 0.2);
}

/* Live clock pulse dot */
@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.7); }
}
