/* ==================== CSS Variables ==================== */
:root {
    --bg-color: #f0f4f8;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #10b981;
    --accent-color: #f43f5e;
    --warning-color: #f59e0b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --card-bg: #1e293b;
    --primary-color: #818cf8;
    --primary-hover: #6366f1;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
}

[data-theme="dark"] .logo {
    filter: brightness(0) invert(1);
}

/* ==================== Base Styles ==================== */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 40%),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.1), transparent 40%);
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ==================== Header ==================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    height: 28px;
    width: auto;
}

.brand-pill {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ==================== Hero Section ==================== */
.hero-section {
    text-align: center;
    margin-bottom: 24px;
}

.hero-section h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-color);
    line-height: 1.2;
}

.hero-desc {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 32px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ==================== Scanner Card ==================== */
.scanner-card {
    background-color: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
}

.scanner-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.options-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
}

select,
input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-group {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

/* ==================== Buttons ==================== */
button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
    font-family: inherit;
}

#scan-btn {
    background-color: var(--primary-color);
    color: white;
    white-space: nowrap;
}

#scan-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

#scan-btn:active {
    transform: translateY(0);
}

#theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

#theme-toggle:hover {
    background-color: var(--bg-color);
}

.hidden {
    display: none !important;
}

/* ==================== Status Card ==================== */
.status-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.status-card h3 {
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-card h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* ==================== Progress Container ==================== */
#progress-container {
    margin: 20px 0;
}

/* Main Progress Bar */
.progress-bar-bg {
    background-color: var(--border-color);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar-fill {
    background: linear-gradient(90deg,
            var(--primary-color) 0%,
            var(--primary-hover) 50%,
            var(--primary-color) 100%);
    background-size: 200% 100%;
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
    animation: shimmer 2s infinite linear;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Progress Info */
.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.status-text {
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.status-text.error {
    color: var(--accent-color);
}

.time-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 16px;
    margin: 0;
}

.eta {
    color: var(--primary-color);
    font-weight: 500;
}

/* Phase Progress Bar */
.phase-progress {
    margin-bottom: 16px;
}

.phase-bar {
    background-color: var(--border-color);
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.phase-fill {
    background-color: var(--secondary-color);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

#phase-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==================== Scan Steps ==================== */
.scan-steps {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.step {
    flex: 1;
    padding: 10px 4px;
    border-radius: 8px;
    background-color: var(--bg-color);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.step-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    transition: all 0.3s ease;
}

.step.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.1);
}

.step.active .step-icon {
    background: var(--primary-color);
    color: white;
    animation: pulse-ring 1.5s ease-out infinite;
}

.step.completed {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.step.completed .step-icon {
    background: white;
    color: var(--secondary-color);
}

.step.completed .step-icon::after {
    content: '\2713';
    font-size: 0.8rem;
    font-weight: 700;
}

.step.completed .step-icon {
    font-size: 0;
}

.step.error {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.step.error .step-icon {
    background: white;
    color: var(--accent-color);
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

/* ==================== Live Port Discovery ==================== */
.discovery-section {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.discovery-section h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    color: var(--text-color);
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background: var(--secondary-color);
    border-radius: 50%;
    animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.port-count {
    margin-left: auto;
    background: var(--primary-color);
    color: white;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.port-feed {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.port-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: 8px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.port-item-new {
    animation: slide-in 0.3s ease-out;
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-color);
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.port-number {
    font-weight: 700;
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--primary-color);
    min-width: 50px;
}

.port-protocol {
    background: var(--border-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
}

.port-state {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.port-state.open {
    background: rgba(16, 185, 129, 0.2);
    color: var(--secondary-color);
}

.port-state.filtered {
    background: rgba(251, 191, 36, 0.2);
    color: var(--warning-color);
}

.port-state.closed {
    background: rgba(244, 63, 94, 0.2);
    color: var(--accent-color);
}

.port-service {
    color: var(--text-muted);
    flex: 1;
}

.port-version {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ==================== Scan Detail ==================== */
.scan-detail {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 12px;
    padding: 8px;
    background: var(--bg-color);
    border-radius: 6px;
}

/* ==================== Download Button ==================== */
.btn-secondary {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 8px;
    margin-top: 20px;
    font-weight: 600;
    text-align: center;
    width: 100%;
    transition: all 0.2s;
}

.btn-secondary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-secondary:disabled,
.btn-secondary.disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
    transform: none;
}

/* ==================== Summary Box ==================== */
.summary-box {
    background: var(--bg-color);
    padding: 16px;
    border-radius: 12px;
    margin-top: 16px;
    border: 1px solid var(--border-color);
}

.summary-box p {
    margin: 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-box strong {
    color: var(--text-muted);
}

.summary-box span {
    font-weight: 500;
}

/* Grade Colors */
.grade {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.grade-a {
    background: rgba(16, 185, 129, 0.2);
    color: var(--secondary-color);
}

.grade-b {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-color);
}

.grade-c {
    background: rgba(251, 191, 36, 0.2);
    color: var(--warning-color);
}

.grade-f {
    background: rgba(244, 63, 94, 0.2);
    color: var(--accent-color);
}

/* ==================== Footer ==================== */
footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 20px 0;
    margin-top: auto;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 600px) {
    .input-group {
        flex-direction: column;
    }

    .scan-steps {
        flex-wrap: wrap;
    }

    .step {
        flex: 0 0 calc(33.333% - 4px);
        margin-bottom: 4px;
    }

    .progress-info {
        flex-direction: column;
        text-align: center;
    }

    .port-item {
        flex-wrap: wrap;
    }

    .port-service {
        width: 100%;
        margin-top: 4px;
    }
}

@media (max-width: 400px) {
    .step {
        flex: 0 0 calc(50% - 4px);
    }

    .step span {
        font-size: 0.65rem;
    }
}

/* ==================== Port Grid Visualization ==================== */
.port-grid-section {
    margin-top: 24px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.port-grid-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--primary-color));
    background-size: 200% 100%;
    animation: gradient-flow 3s linear infinite;
}

@keyframes gradient-flow {
    0% {
        background-position: 0% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.grid-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.radar-pulse {
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    position: relative;
    animation: radar-pulse 1.5s ease-out infinite;
}

.radar-pulse::before,
.radar-pulse::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    animation: radar-ring 1.5s ease-out infinite;
}

.radar-pulse::after {
    animation-delay: 0.5s;
}

@keyframes radar-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

@keyframes radar-ring {
    0% {
        width: 12px;
        height: 12px;
        opacity: 1;
    }

    100% {
        width: 36px;
        height: 36px;
        opacity: 0;
    }
}

.grid-legend {
    display: flex;
    gap: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.legend-dot.unknown {
    background: var(--border-color);
}

.legend-dot.scanning {
    background: var(--primary-color);
    animation: port-pulse 0.8s ease-in-out infinite;
}

.legend-dot.open {
    background: var(--secondary-color);
}

.legend-dot.filtered {
    background: var(--warning-color);
}

.legend-dot.closed {
    background: #475569;
}

/* The Port Grid itself */
.port-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10px, 1fr));
    gap: 3px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    min-height: 120px;
    max-height: 280px;
    overflow-y: auto;
    position: relative;
}

.port-grid::-webkit-scrollbar {
    width: 6px;
}

.port-grid::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 3px;
}

.port-grid::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.port-grid::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.port-cell {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.port-cell:hover {
    transform: scale(1.8);
    z-index: 10;
    box-shadow: 0 0 8px currentColor;
}

.port-cell.scanning {
    background: var(--primary-color);
    animation: port-pulse 0.6s ease-in-out infinite;
    box-shadow: 0 0 6px var(--primary-color);
}

.port-cell.open {
    background: var(--secondary-color);
    box-shadow: 0 0 8px var(--secondary-color);
    animation: port-glow 2s ease-in-out infinite;
}

.port-cell.filtered {
    background: var(--warning-color);
    box-shadow: 0 0 4px var(--warning-color);
}

.port-cell.closed {
    background: #475569;
    opacity: 0.4;
}

@keyframes port-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

@keyframes port-glow {

    0%,
    100% {
        box-shadow: 0 0 4px var(--secondary-color);
    }

    50% {
        box-shadow: 0 0 12px var(--secondary-color), 0 0 20px rgba(16, 185, 129, 0.3);
    }
}

/* Port Tooltip */
.port-tooltip {
    position: fixed;
    background: var(--card-bg);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.port-tooltip.visible {
    opacity: 1;
}

.port-tooltip .tooltip-port {
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Consolas', 'Monaco', monospace;
}

.port-tooltip .tooltip-service {
    color: var(--text-muted);
    margin-left: 8px;
}

/* ==================== Statistics Dashboard ==================== */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.stat-card {
    background: var(--card-bg);
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-color, var(--primary-color));
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--stat-color, var(--text-color));
    line-height: 1;
    margin-bottom: 4px;
    transition: all 0.3s ease;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-card.scanned {
    --stat-color: var(--primary-color);
}

.stat-card.open {
    --stat-color: var(--secondary-color);
}

.stat-card.filtered {
    --stat-color: var(--warning-color);
}

.stat-card.closed {
    --stat-color: #64748b;
}

/* Animated number counter effect */
.stat-value.animating {
    animation: number-pop 0.3s ease-out;
}

@keyframes number-pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

/* ==================== Activity Log Panel ==================== */
.activity-log-section {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.activity-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.activity-log-header h4 {
    margin: 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.activity-log-header .log-icon {
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
}

.log-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--card-bg);
    padding: 2px 8px;
    border-radius: 999px;
}

.activity-log {
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-log::-webkit-scrollbar {
    width: 4px;
}

.activity-log::-webkit-scrollbar-track {
    background: transparent;
}

.activity-log::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    background: var(--card-bg);
    border-radius: 8px;
    font-size: 0.8rem;
    border-left: 3px solid var(--log-color, var(--border-color));
    animation: log-slide-in 0.3s ease-out;
}

@keyframes log-slide-in {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.log-entry.info {
    --log-color: var(--primary-color);
}

.log-entry.success {
    --log-color: var(--secondary-color);
}

.log-entry.warning {
    --log-color: var(--warning-color);
}

.log-entry.error {
    --log-color: var(--accent-color);
}

.log-timestamp {
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--text-muted);
    font-size: 0.7rem;
    flex-shrink: 0;
    min-width: 60px;
}

.log-message {
    flex: 1;
    word-break: break-word;
}

.log-message .highlight {
    color: var(--primary-color);
    font-weight: 600;
}

.log-message .port-highlight {
    color: var(--secondary-color);
    font-weight: 700;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* ==================== Scan Config Display ==================== */
.scan-config {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-top: 16px;
    flex-wrap: wrap;
}

.config-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.config-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.config-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.config-value.ip {
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--primary-color);
}

/* ==================== Enhanced Progress Section ==================== */
.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-percentage {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Consolas', 'Monaco', monospace;
    line-height: 1;
}

.progress-bar-enhanced {
    height: 12px;
    background: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-bar-enhanced .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 6px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar-enhanced .fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.3) 50%,
            transparent 100%);
    animation: shimmer 1.5s infinite;
}

/* ==================== Scanning Wave Effect ==================== */
.scan-wave-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: 12px;
}

.scan-wave {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    background: linear-gradient(90deg,
            transparent,
            rgba(99, 102, 241, 0.2),
            rgba(99, 102, 241, 0.4),
            rgba(99, 102, 241, 0.2),
            transparent);
    animation: wave-sweep 2s linear infinite;
}

@keyframes wave-sweep {
    0% {
        left: -60px;
    }

    100% {
        left: 100%;
    }
}

/* ==================== Glassmorphism Panels ==================== */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
}

[data-theme="dark"] .glass-panel {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==================== Speed Meter ==================== */
.speed-meter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.speed-icon {
    color: var(--primary-color);
}

.speed-value {
    font-weight: 700;
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--secondary-color);
}

.speed-label {
    color: var(--text-muted);
}

/* ==================== Responsive Adjustments ==================== */
@media (max-width: 600px) {
    .stats-dashboard {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .grid-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .grid-legend {
        flex-wrap: wrap;
    }

    .scan-config {
        flex-direction: column;
        gap: 12px;
    }

    .port-grid {
        grid-template-columns: repeat(auto-fill, minmax(8px, 1fr));
    }

    .port-cell {
        width: 8px;
        height: 8px;
    }
}

@media (max-width: 400px) {
    .stats-dashboard {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 1.2rem;
    }
}

/* ==================== Completion Celebration ==================== */
.scan-complete-celebration {
    position: relative;
}

.scan-complete-celebration::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color), var(--secondary-color));
    background-size: 200% 200%;
    border-radius: 18px;
    z-index: -1;
    animation: celebration-glow 2s ease-in-out infinite;
}

@keyframes celebration-glow {

    0%,
    100% {
        background-position: 0% 50%;
        opacity: 0.5;
    }

    50% {
        background-position: 100% 50%;
        opacity: 1;
    }
}