/* Dashboard Design System */
:root {
    --bg-color: rgba(10, 10, 10, 0.7);
    --panel-bg: rgba(17, 17, 17, 0.6);
    --border-color: #333333;
    --text-primary: #e0e0e0;
    --text-secondary: #888888;
    --accent-color: #00ff41;
    /* Matrix Green-ish */
    --accent-dim: rgba(0, 255, 65, 0.1);
    --alert-color: #ff3333;
    --font-mono: 'Share Tech Mono', monospace;
    --font-sans: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: #000;
    /* Deep black backing */
    color: var(--text-primary);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    /* Dashboard feel */
    display: flex;
    flex-direction: column;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    /* In front of UI */
    pointer-events: none;
    opacity: 0.8;
    /* High visibility */
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-color);
}

/* Layout */
.dashboard-container {
    position: relative;
    z-index: 1;
    /* Above canvas */
    display: grid;
    grid-template-columns: 300px 1fr 350px;
    /* Sidebar, Main, Sidebar */
    grid-template-rows: 80px 1fr;
    height: 100vh;
    gap: 1px;
    background-color: rgba(51, 51, 51, 0.3);
    /* Semi-transparent borders */
}

/* Header */
.header {
    grid-column: 1 / -1;
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(5px);
    /* Glass effect */
}

.header-title {
    font-size: 1.5rem;
    color: var(--accent-color);
}

.header-meta {
    display: flex;
    gap: 20px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Panels */
.panel {
    background-color: var(--bg-color);
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    backdrop-filter: blur(5px);
}

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

.panel-title {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Components */
.card {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 4px;
}

.card:hover {
    border-color: var(--accent-color);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: bold;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.trend-up {
    color: var(--accent-color);
}

.trend-down {
    color: var(--alert-color);
}

/* Project Links */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.project-item {
    background: rgba(0, 20, 0, 0.4);
    border: 1px solid var(--border-color);
    padding: 15px;
    text-decoration: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    /* Contain glitch bleed */
}

.project-item:hover {
    background: rgba(0, 255, 65, 0.1);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.project-icon {
    font-size: 1.5rem;
    color: var(--accent-color);
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.project-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Contain text */
}

.project-name {
    color: #fff;
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.project-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Sports & Weather Lists */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.list-item:last-child {
    border-bottom: none;
}

.team-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.matchup-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: bold;
    position: relative;
    padding-left: 24px;
    /* Make room for the sport icon */
}

.matchup-row .fa-solid.sport-icon {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.team-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.game-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.odds {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: var(--border-color);
    padding: 2px 6px;
    border-radius: 2px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-container {
        grid-template-columns: 1fr;
        grid-template-rows: 60px auto auto auto;
        height: auto;
        overflow-y: auto;

    }
}

/* Progress Bars */
.progress-bar {
    width: 100%;
    height: 4px;
    background: #222;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-color);
    box-shadow: 0 0 5px var(--accent-color);
    transition: width 0.5s ease;
}

/* Todo List */
.todo-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.todo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.todo-content {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex-grow: 1;
}

.todo-delete {
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0 8px;
    opacity: 0.5;
    transition: all 0.2s;
}

.todo-delete:hover {
    color: var(--alert-color);
    opacity: 1;
}

.todo-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

#scratchpad {
    width: 100%;
    height: 100px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--accent-color);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    padding: 10px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

#scratchpad:focus {
    border-color: var(--accent-color);
}

#clear-scratchpad:hover {
    color: var(--alert-color) !important;
}

.todo-check {
    font-family: var(--font-mono);
    color: var(--accent-color);
}

.todo-text {
    font-size: 0.9rem;
}

.todo-item.done .todo-text {
    text-decoration: line-through;
    color: var(--text-secondary);
    opacity: 0.6;
}

.todo-input-row {
    display: flex;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

#todo-input {
    background: transparent;
    border: none;
    color: #fff;
    font-family: var(--font-mono);
    width: 100%;
    outline: none;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

@keyframes scanline {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(100%);
    }
}

/* Apply Animations */
.card,
.project-item,
.list-item {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    /* Start hidden */
}

/* Stagger delays for a cascading effect */
.card:nth-child(1) {
    animation-delay: 0.1s;
}

.card:nth-child(2) {
    animation-delay: 0.2s;
}

.card:nth-child(3) {
    animation-delay: 0.3s;
}

.project-item:nth-child(odd) {
    animation-delay: 0.2s;
}

.project-item:nth-child(even) {
    animation-delay: 0.3s;
}

.list-item:nth-child(1) {
    animation-delay: 0.1s;
}

.list-item:nth-child(2) {
    animation-delay: 0.2s;
}

.list-item:nth-child(3) {
    animation-delay: 0.3s;
}

.list-item:nth-child(4) {
    animation-delay: 0.4s;
}

.list-item:nth-child(5) {
    animation-delay: 0.5s;
}

/* Loading State */
.loading-text {
    animation: pulse 1.5s infinite ease-in-out;
    color: var(--text-secondary);
    font-style: italic;
}

/* CRT Scanline Effect Overlay (Optional, subtle) */
.dashboard-container::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

/* Typewriter Cursor */
.cursor {
    display: inline-block;
    animation: blink 1s step-end infinite;
    color: var(--accent-color);
    margin-left: 2px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Sports Card Hover Effects */
.sports-card {
    position: relative;
    overflow: hidden;
    /* Keep hover content contained initially */
    transition: all 0.3s ease;
}

/* .sports-card .team-info - removed align-items: center to allow left alignment for icon consistency */

.sports-card:hover {
    background: rgba(0, 255, 65, 0.05);
    /* Removed border-left to prevent overlap */
}

/* Fix for long IP addresses and status text */
#uplink-ip,
#uplink-loc,
#uplink-isp {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    /* Adjust based on container width */
    display: inline-block;
    vertical-align: middle;
}

.tv-badge {
    background: #333;
    color: #fff;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.65rem;
    margin-left: 6px;
    border: 1px solid #555;
}

.sports-hover-detail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(10, 10, 10, 1), rgba(20, 20, 20, 0.98));
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center vertically */
    align-items: center;
    opacity: 0;
    transform: translateY(100%);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    padding: 0 8px;
    /* Minimal padding */
    border-top: 2px solid var(--accent-color);
    /* Thicker accent */
}

.sports-card:hover .sports-hover-detail {
    opacity: 1;
    transform: translateY(0);
    /* pointer-events: auto; Removed to allow click-through to parent <a> */
}

.hover-teams {
    font-size: 0.75rem;
    /* Smaller */
    line-height: 1.1;
    font-weight: 600;
    /* Thinner */
    color: #eee;
    margin-bottom: 4px;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    /* Graceful wrap handling */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hover-stats {
    display: flex;
    gap: 15px;
    width: 100%;
    justify-content: center;
    padding: 0;
    margin: 0;
    border: none;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-box .label {
    font-size: 0.5rem;
    color: #888;
    font-weight: 500;
    margin-bottom: 0;
    text-transform: uppercase;
}

.stat-box .value {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-family: 'Courier New', monospace;
    font-weight: 700;
    text-shadow: none;
    /* Removed glow for cleaner look */
}

/* Chart Container */
.chart-container {
    height: 60px;
    margin-top: 10px;
    position: relative;
}

/* Mobile Layout Refinements */
@media (max-width: 768px) {

    html,
    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
        position: relative;
    }

    body {
        height: auto;
        overflow-y: auto;
    }

    .dashboard-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        /* Allow header to grow */
        height: auto;
        padding: 10px;
        gap: 20px;
    }

    .panel {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        margin-bottom: 20px;
    }

    .scroll-container {
        height: auto !important;
        max-height: none !important;
        overflow-y: visible !important;
    }

    /* Ensure charts have height on mobile but stay contained */
    .chart-container {
        height: auto;
        /* Let it grow */
    }

    canvas {
        min-height: 150px;
        max-width: 100%;
    }

    /* Fix System Ready spacing */
    #system-status {
        margin-top: 10px;
        /* Reduced since header can grow */
        display: block;
        margin-bottom: 5px;
    }

    /* Adjust center section spacing */
    .center-panel {
        margin-bottom: 30px;
    }
}