:root {
    --bg-color: #0f172a;
    --text-color: #e2e8f0;
    --primary-color: #3b82f6;
    --secondary-color: #64748b;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
    z-index: -1;
}

/* Navigation */
.main-nav {
    background: #000000;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    padding: 0;
    min-height: 64px;
}

.nav-links {
    display: flex;
    gap: 0;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0 2rem;
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    color: #ffffff;
    border-bottom-color: #3b82f6;
    background: rgba(59, 130, 246, 0.2);
}

.nav-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 0 2rem;
    flex-shrink: 0;
}

.logout-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 0.5rem;
    padding: 0.625rem 1.25rem;
    color: #fca5a5;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.6);
    color: #fee2e2;
    transform: translateY(-1px);
}

.logout-btn:active {
    transform: translateY(0);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

/* Search Box */
.analysis-overview {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.analysis-overview h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.analysis-overview > p {
    color: var(--secondary-color);
    line-height: 1.5;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.overview-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.overview-item {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 1rem;
}

.overview-item ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.overview-item li {
    color: var(--secondary-color);
    line-height: 1.3;
    padding: 0.25rem 0;
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.9rem;
}

.overview-item li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.2rem;
}

.overview-item li strong {
    color: var(--text-color);
    font-weight: 600;
}

.search-box {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--secondary-color);
}

input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: white;
    font-family: inherit;
    transition: all 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

select {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    color: #ffffff;
    font-family: inherit;
    /* font-size: 0.95rem; */
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
}

select:hover {
    background-color: rgba(15, 23, 42, 0.9);
    border-color: rgba(59, 130, 246, 0.5);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background-color: rgba(15, 23, 42, 0.95);
}

select:active {
    border-color: var(--primary-color);
}

select option {
    background: #1e293b;
    color: #ffffff;
    padding: 0.5rem;
}

button {
    background: var(--accent-gradient);
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

button:hover {
    opacity: 0.9;
}

button:active {
    transform: scale(0.98);
}

/* Results Table */
.results-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    background: rgba(15, 23, 42, 0.8);
    font-weight: 600;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.htmx-indicator {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

.loading-container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2rem 3rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    text-align: center;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--glass-border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

.loading-text {
    color: var(--text-color);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #8b5cf6);
    border-radius: 4px;
    animation: progress 1.5s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

@keyframes progress {
    0% {
        width: 0%;
        opacity: 0.5;
    }

    50% {
        width: 100%;
        opacity: 1;
    }

    100% {
        width: 100%;
        opacity: 0.5;
    }
}

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

.htmx-request .htmx-indicator {
    display: block;
}

/* Show loading indicator when any htmx request is in progress */
body.htmx-request #loading {
    display: block !important;
}

.htmx-request.results-container {
    opacity: 0.5;
    pointer-events: none;
}

.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--secondary-color);
}

/* Results Info */
.results-info {
    padding: 1rem;
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.875rem;
    background: rgba(15, 23, 42, 0.5);
    border-bottom: 1px solid var(--glass-border);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.5);
    border-top: 1px solid var(--glass-border);
}

.page-btn {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid var(--primary-color);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 45px;
}

.page-btn:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-btn-active {
    background: var(--primary-color) !important;
    opacity: 1 !important;
    cursor: default !important;
}

.page-ellipsis {
    color: var(--secondary-color);
    padding: 0 0.5rem;
}

.page-info {
    color: var(--text-color);
    font-weight: 500;
    min-width: 120px;
    text-align: center;
}

.pagination-limit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: auto;
}

.pagination-limit label {
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
}

.pagination-limit select {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid var(--primary-color);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.pagination-limit select:hover {
    background: rgba(59, 130, 246, 0.3);
}

.pagination-limit select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Dashboard Styles */
.dashboard-results {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    overflow: visible;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow: visible;
    position: relative;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    overflow: visible;
}

.stat-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: visible;
    position: relative;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: visible;
}

.tooltip-icon {
    font-size: 0.75rem;
    cursor: help;
    opacity: 0.6;
    transition: opacity 0.2s;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.tooltip-icon:hover {
    opacity: 1;
    background: rgba(59, 130, 246, 0.3);
}

.tooltip-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.98);
    color: var(--text-color);
    padding: 0.875rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 400;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    min-width: 350px;
    max-width: 450px;
    white-space: normal;
    text-align: left;
    line-height: 1.6;
    text-transform: none;
    letter-spacing: normal;
    margin-bottom: 0.5rem;
}

.tooltip-icon::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 0.25rem);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(15, 23, 42, 0.98);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10001;
}

.tooltip-icon:hover::after,
.tooltip-icon:hover::before {
    opacity: 1;
    transform: translateX(-50%);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.chart-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.chart-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    text-align: center;
}

.chart-wrapper {
    height: 300px;
    position: relative;
}

.chart-card canvas {
    max-height: 100%;
}

.error-state {
    padding: 2rem;
    text-align: center;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.75rem;
}

/* Analysis Tabs */
.analysis-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 0.5rem;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    padding: 1rem;
    color: var(--secondary-color);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-color);
}

.tab-btn.active {
    background: var(--accent-gradient);
    color: white;
}

/* MAC Distribution Styles */
.mac-distributions {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.mac-distribution-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

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

.mac-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.mac-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.ssid-distribution-list h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.ssid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.ssid-table th,
.ssid-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.ssid-table th {
    background: rgba(15, 23, 42, 0.8);
    font-weight: 600;
    color: var(--secondary-color);
    text-transform: uppercase;
    font-size: 0.75rem;
}

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

/* Temporal Pattern Styles */
.temporal-patterns {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.temporal-pattern-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

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

.pattern-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.pattern-stats {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.score-badge {
    background: var(--accent-gradient);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
}

.transitions-section,
.sequences-section {
    margin-top: 1.5rem;
}

.transitions-section h4,
.sequences-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.transition-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.transition-table th,
.transition-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.transition-table th {
    background: rgba(15, 23, 42, 0.8);
    font-weight: 600;
    color: var(--secondary-color);
    text-transform: uppercase;
    font-size: 0.75rem;
}

.sequence-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sequence-item {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 1rem;
}

.sequence-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.sequence-ssids {
    font-weight: 600;
    color: var(--text-color);
}

.sequence-duration {
    color: var(--secondary-color);
    font-size: 0.875rem;
}

.sequence-time {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.info-message {
    padding: 1.5rem;
    text-align: center;
    color: var(--secondary-color);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 0.75rem;
}
