/* ===== CSS Variables / Design Tokens! ===== */
:root {
    /* Colors from GKS Palette - Dark Theme */
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-tertiary: #1a1a1d;
    --bg-card: rgba(26, 26, 29, 0.8);
    --bg-card-hover: rgba(36, 36, 40, 0.9);

    --text-primary: #ffffff;
    --text-secondary: #a0a0a5;
    --text-muted: #6b6b70;

    --accent-primary: #00d4aa;
    --accent-secondary: #00b894;
    --accent-glow: rgba(0, 212, 170, 0.3);

    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 212, 170, 0.5);

    /* Status Colors */
    --status-online: #00d4aa;
    --status-offline: #ff6b6b;
    --status-warning: #ffd93d;
    --status-pending: #6c5ce7;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;

    /* Font */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Header height for sticky positioning */
    --header-height: 70px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8ec;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(245, 245, 247, 0.95);

    --text-primary: #1a1a1d;
    --text-secondary: #4a4a4f;
    --text-muted: #8a8a8f;

    --border-color: rgba(0, 0, 0, 0.08);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ===== Base Styles ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated background gradient effect - smooth version */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 30% 30%, rgba(0, 212, 170, 0.08) 0%, transparent 40%),
        radial-gradient(ellipse at 70% 70%, rgba(0, 184, 148, 0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(99, 102, 241, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    animation: gradientMove 30s ease-in-out infinite;
}

@keyframes gradientMove {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(5%, 5%) rotate(2deg);
    }

    50% {
        transform: translate(0, 10%) rotate(0deg);
    }

    75% {
        transform: translate(-5%, 5%) rotate(-2deg);
    }
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    transition: var(--transition-normal);
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

[data-theme="light"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="light"] .theme-toggle .moon-icon {
    display: none;
}

/* ===== Notification Container ===== */
.notification-container {
    position: fixed;
    top: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    pointer-events: none;
}

.notification {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: slideDown 0.3s ease, fadeOut 0.3s ease 4.7s forwards;
    pointer-events: auto;
}

.notification.success {
    border-color: var(--status-online);
}

.notification.error {
    border-color: var(--status-offline);
}

.notification.warning {
    border-color: var(--status-warning);
}

.notification.info {
    border-color: var(--accent-primary);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ===== Header ===== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) var(--spacing-xl);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    animation: headerSlideDown 0.5s ease;
}

@keyframes headerSlideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }

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

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.logo {
    height: 48px;
    width: auto;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

/* Greeting Widget */
.greeting-widget {
    grid-column: 1 / -1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    padding: var(--spacing-lg) var(--spacing-xl);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: var(--spacing-lg);
    animation: widgetFadeIn 0.6s ease forwards;
    opacity: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.greeting-widget:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 8px 32px rgba(0, 212, 170, 0.15);
}

/* Sticky mode - transforms into sleek header bar below main header */
.greeting-widget.sticky {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    z-index: 998;
    grid-column: auto;
    border-radius: 0;
    padding: var(--spacing-sm) var(--spacing-xl);
    margin: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    transform: none !important;
    animation: slideDownSticky 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.greeting-widget.sticky:hover {
    transform: none !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Compact sticky styling with smooth transitions */
.greeting-widget.sticky .mascot {
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

.greeting-widget.sticky .mascot-antenna {
    height: 8px;
    transition: height 0.3s ease;
}

.greeting-widget.sticky .mascot-head {
    width: 35px;
    height: 28px;
    transition: all 0.3s ease;
}

.greeting-widget.sticky .mascot-eye {
    width: 10px;
    height: 10px;
    transition: all 0.3s ease;
}

.greeting-widget.sticky .greeting-text {
    font-size: 1.1rem;
    transition: font-size 0.3s ease;
}

.greeting-widget.sticky .current-time {
    font-size: 0.9rem;
    transition: font-size 0.3s ease;
}

/* Placeholder to prevent content jump when greeting becomes sticky */
.greeting-placeholder {
    grid-column: 1 / -1;
    visibility: hidden;
}

.greeting-content {
    display: flex;
    flex: 1;
    justify-content: space-between;
    align-items: center;
}

.greeting-text {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.current-time {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ===== Mascot Character ===== */
.mascot {
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.mascot:hover {
    transform: scale(1.1);
}

.mascot:hover .mascot-mouth {
    height: 8px;
    border-radius: 0 0 10px 10px;
}

.mascot-body {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mascot-antenna {
    width: 3px;
    height: 12px;
    background: linear-gradient(to top, var(--accent-primary), var(--accent-secondary));
    border-radius: 3px;
    position: relative;
    animation: antennaBob 2s ease-in-out infinite;
    transform-origin: bottom center;
}

@keyframes antennaBob {

    0%,
    100% {
        transform: rotate(-5deg);
    }

    50% {
        transform: rotate(5deg);
    }
}

.antenna-ball {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--accent-primary), 0 0 30px var(--accent-primary);
    animation: antennaPulse 1.5s ease-in-out infinite;
}

@keyframes antennaPulse {

    0%,
    100% {
        box-shadow: 0 0 10px var(--accent-primary), 0 0 20px var(--accent-primary);
        transform: translateX(-50%) scale(1);
    }

    50% {
        box-shadow: 0 0 20px var(--accent-primary), 0 0 40px var(--accent-primary);
        transform: translateX(-50%) scale(1.2);
    }
}

.mascot-head {
    width: 50px;
    height: 40px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-card) 100%);
    border: 2px solid var(--accent-primary);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 212, 170, 0.2), inset 0 2px 10px rgba(255, 255, 255, 0.05);
}

.mascot-eye {
    width: 14px;
    height: 14px;
    background: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.mascot-pupil {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    transition: transform 0.1s ease-out;
    box-shadow: 0 0 8px var(--accent-primary);
    position: relative;
}

.mascot-pupil::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 2px;
    width: 3px;
    height: 3px;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
}

.mascot-mouth {
    position: absolute;
    bottom: 6px;
    width: 12px;
    height: 4px;
    background: var(--accent-primary);
    border-radius: 0 0 6px 6px;
    transition: all 0.3s ease;
}

/* Mascot expressions */
.mascot.happy .mascot-mouth {
    height: 10px;
    border-radius: 0 0 12px 12px;
}

.mascot.blink .mascot-eye {
    height: 3px;
}

/* Idle animation - occasional blink */
.mascot-eye {
    animation: mascotBlink 4s ease-in-out infinite;
}

@keyframes mascotBlink {

    0%,
    45%,
    55%,
    100% {
        height: 14px;
    }

    48%,
    52% {
        height: 3px;
    }
}

@keyframes mascotBounce {

    0%,
    100% {
        transform: scale(1) translateY(0);
    }

    25% {
        transform: scale(1.1) translateY(-10px);
    }

    50% {
        transform: scale(0.95) translateY(0);
    }

    75% {
        transform: scale(1.05) translateY(-5px);
    }
}

/* Mascot floating state - follows scroll */
.mascot.floating {
    position: fixed;
    top: 50%;
    left: 20px;
    z-index: 1000;
    animation: mascotDropIn 0.6s ease-out forwards, mascotFloat 3s ease-in-out 0.6s infinite;
}

@keyframes mascotDropIn {
    0% {
        top: 10px;
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }

    50% {
        transform: translateY(0) scale(1.2);
        opacity: 1;
    }

    100% {
        top: 50%;
        transform: translateY(-50%) scale(1);
    }
}

@keyframes mascotFloat {

    0%,
    100% {
        transform: translateY(-50%);
    }

    50% {
        transform: translateY(calc(-50% - 5px));
    }
}

/* Mascot jumping to widget */
.mascot.jumping {
    animation: mascotJump 0.3s ease-out forwards;
}

@keyframes mascotJump {
    0% {
        transform: scale(1) translateY(0);
    }

    30% {
        transform: scale(1.2) translateY(-30px);
    }

    60% {
        transform: scale(0.9) translateY(10px);
    }

    100% {
        transform: scale(1) translateY(0);
    }
}

/* Mascot on a widget */
.mascot.on-widget {
    position: absolute;
    transition: top 0.3s ease, left 0.3s ease;
}

/* Mascot sad expression */
.mascot.sad .mascot-antenna {
    animation: antennaDroop 2s ease-in-out infinite;
}

@keyframes antennaDroop {

    0%,
    100% {
        transform: rotate(-15deg);
    }

    50% {
        transform: rotate(-20deg);
    }
}

.mascot.sad .antenna-ball {
    background: var(--status-offline);
    box-shadow: 0 0 10px var(--status-offline);
    animation: sadPulse 2s ease-in-out infinite;
}

@keyframes sadPulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.mascot.sad .mascot-mouth {
    width: 10px;
    height: 6px;
    border-radius: 6px 6px 0 0;
    background: var(--status-offline);
    bottom: 8px;
}

.mascot.sad .mascot-eye {
    animation: none;
}

.mascot.sad .mascot-pupil {
    background: var(--text-muted);
    box-shadow: none;
    transform: translateY(2px) !important;
}

/* Worried expression when starting */
.mascot.worried .mascot-mouth {
    width: 8px;
    height: 4px;
    border-radius: 2px;
    background: var(--status-warning);
}

.mascot.worried .antenna-ball {
    background: var(--status-warning);
    box-shadow: 0 0 10px var(--status-warning);
}

@media (max-width: 600px) {
    .greeting-widget {
        flex-direction: column;
        gap: var(--spacing-sm);
        text-align: center;
        padding: var(--spacing-md);
    }

    /* Keep sticky mode horizontal even on mobile */
    .greeting-widget.sticky {
        flex-direction: row;
        text-align: left;
        padding: var(--spacing-xs) var(--spacing-md);
        gap: var(--spacing-sm);
    }

    .greeting-widget.sticky .greeting-content {
        flex-direction: row;
        gap: var(--spacing-sm);
    }

    .greeting-widget.sticky .greeting-text {
        font-size: 0.9rem;
    }

    .greeting-widget.sticky .current-time {
        font-size: 0.8rem;
    }

    .greeting-widget.sticky .mascot {
        transform: scale(0.6);
    }

    .greeting-content {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .greeting-text {
        font-size: 1.2rem;
    }

    .current-time {
        font-size: 1rem;
    }

    .mascot-head {
        width: 40px;
        height: 32px;
    }

    .mascot-eye {
        width: 10px;
        height: 10px;
    }

    .mascot-pupil {
        width: 6px;
        height: 6px;
    }
}

.site-title {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: var(--spacing-md);
}

/* Nav buttons for Jellyfin/Jellyseerr */
.nav-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition-normal);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nav-btn svg {
    flex-shrink: 0;
}

/* Jellyfin button - purple theme */
.jellyfin-btn {
    color: #a855f7;
    border-color: rgba(168, 85, 247, 0.3);
}

.jellyfin-btn:hover {
    background: rgba(168, 85, 247, 0.1);
    border-color: #a855f7;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
}

/* Jellyseerr button - yellow/gold theme */
.jellyseerr-btn {
    color: #eab308;
    border-color: rgba(234, 179, 8, 0.3);
}

.jellyseerr-btn:hover {
    background: rgba(234, 179, 8, 0.1);
    border-color: #eab308;
    box-shadow: 0 0 15px rgba(234, 179, 8, 0.3);
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-link.active {
    color: var(--accent-primary);
}

/* Header right section with nav and actions */
.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Edit toggle button */
.edit-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    transition: var(--transition-normal);
}

.edit-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

/* ===== Main Content ===== */
.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-xl);
    min-height: calc(100vh - 180px);
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(150px, auto);
    gap: var(--spacing-lg);
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    /* Reset widget spans and width on mobile - force single column */
    .dashboard-grid .widget {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
}

/* ===== Widget Styles ===== */
.widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: default;
    animation: widgetFadeIn 0.6s ease forwards;
    opacity: 0;
}

/* Staggered animation delays for widgets */
.widget:nth-child(1) {
    animation-delay: 0.1s;
}

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

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

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

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

@keyframes widgetFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.widget:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 8px 32px rgba(0, 212, 170, 0.15);
    transform: translateY(-3px);
}

.widget.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.widget.drag-over {
    border-color: var(--accent-primary);
    background: var(--bg-card-hover);
}

.widget-wide {
    grid-column: span 2;
}

@media (max-width: 800px) {
    .widget-wide {
        grid-column: span 1;
    }
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.widget-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.widget-title svg {
    color: var(--accent-primary);
}

.widget-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.refresh-indicator {
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.refresh-indicator.active svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.widget-link {
    color: var(--text-secondary);
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
}

.widget-link:hover {
    color: var(--accent-primary);
    background: rgba(0, 212, 170, 0.1);
}

.widget-content {
    padding: var(--spacing-lg);
    min-height: 150px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    overflow: visible;
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: auto;
}

/* ===== Proxmox Widget Specific ===== */
.node-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.node-card {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(0, 212, 170, 0.03) 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.node-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0, 212, 170, 0.15);
}

.node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
}

.node-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--status-online);
    box-shadow: 0 0 12px var(--status-online);
    animation: statusPulse 2s ease-in-out infinite;
}

.status-indicator.offline {
    background: var(--status-offline);
    box-shadow: 0 0 12px var(--status-offline);
    animation: none;
}

.node-name {
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: capitalize;
}

.node-meta {
    display: flex;
    gap: var(--spacing-sm);
}

.vm-badge,
.uptime-badge {
    background: var(--bg-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.vm-badge {
    color: var(--accent-primary);
}

/* Circular Gauges */
.node-gauges {
    display: flex;
    justify-content: space-around;
    gap: var(--spacing-md);
}

.gauge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.gauge-ring {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: conic-gradient(var(--color) calc(var(--percent) * 1%),
            var(--bg-primary) calc(var(--percent) * 1%));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Animated gauge fill effect */
.gauge-ring.animated {
    animation: gaugeFillIn 1s ease-out forwards;
    background: conic-gradient(var(--color) 0%, var(--bg-primary) 0%);
}

@keyframes gaugeFillIn {
    0% {
        background: conic-gradient(var(--color) 0%, var(--bg-primary) 0%);
    }

    100% {
        background: conic-gradient(var(--color) calc(var(--percent) * 1%), var(--bg-primary) calc(var(--percent) * 1%));
    }
}

.gauge-ring:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px var(--color);
}

.gauge-inner {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gauge-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gauge-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.gauge-detail {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Mobile responsive for Proxmox */
@media (max-width: 480px) {
    .node-gauges {
        gap: var(--spacing-sm);
    }

    .gauge-ring {
        width: 55px;
        height: 55px;
    }

    .gauge-inner {
        width: 42px;
        height: 42px;
    }

    .gauge-value {
        font-size: 0.75rem;
    }

    .node-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

/* Legacy styles for backwards compatibility */
.node-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
}

.stat {
    text-align: center;
    transition: transform 0.2s ease;
}

.stat:hover {
    transform: scale(1.05);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-primary);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.stat:hover .stat-value {
    text-shadow: 0 0 10px var(--accent-glow);
}

.progress-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: var(--spacing-xs);
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: progressShine 3s ease-in-out infinite;
    z-index: 2;
    pointer-events: none;
}

@keyframes progressShine {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ===== Pyrodactyl Widget (Game Servers) ===== */
.server-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.server-card {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(0, 212, 170, 0.03) 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: serverCardSlideIn 0.5s ease-out forwards;
    opacity: 0;
    transform: translateX(-20px);
}

.server-card:nth-child(1) {
    animation-delay: 0s;
}

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

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

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

@keyframes serverCardSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.server-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.server-card:hover::before {
    opacity: 1;
}

.server-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0, 212, 170, 0.15);
}

.server-card.offline {
    opacity: 0.7;
}

.server-card.starting {
    border-color: var(--status-warning);
}

.server-card.starting::before {
    background: linear-gradient(90deg, var(--status-warning), var(--status-warning));
    opacity: 1;
    animation: startingPulse 1.5s ease-in-out infinite;
}

@keyframes startingPulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.server-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.server-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.server-name {
    font-weight: 700;
    font-size: 1rem;
}

.server-meta {
    display: flex;
    gap: var(--spacing-sm);
}

.status-badge {
    background: var(--bg-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid var(--border-color);
}

.status-badge.online {
    color: var(--status-online);
    border-color: rgba(0, 212, 170, 0.3);
}

.status-badge.offline {
    color: var(--status-offline);
    border-color: rgba(255, 107, 107, 0.3);
}

.status-badge.starting {
    color: var(--status-warning);
    border-color: rgba(255, 193, 7, 0.3);
}

.status-indicator.starting {
    background: var(--status-warning);
    box-shadow: 0 0 12px var(--status-warning);
}

.connection-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

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

.connection-address {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--accent-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    transition: opacity 0.2s ease;
}

.connection-address:hover {
    opacity: 0.8;
}

.connection-address svg {
    opacity: 0.5;
}

.server-gauges {
    display: flex;
    justify-content: space-around;
    gap: var(--spacing-md);
}

/* ===== Portainer Widget (Containers) ===== */
.container-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.container-stat {
    text-align: center;
}

.container-stat .stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

.container-stat .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.container-stat.running .stat-number {
    color: var(--status-online);
}

.container-stat.stopped .stat-number {
    color: var(--status-offline);
}

.container-stat.total .stat-number {
    color: var(--text-secondary);
}

.container-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.container-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    border: 1px solid transparent;
    animation: containerSlideIn 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

.container-item:nth-child(1) {
    animation-delay: 0s;
}

.container-item:nth-child(2) {
    animation-delay: 0.05s;
}

.container-item:nth-child(3) {
    animation-delay: 0.1s;
}

.container-item:nth-child(4) {
    animation-delay: 0.15s;
}

.container-item:nth-child(5) {
    animation-delay: 0.2s;
}

.container-item:nth-child(6) {
    animation-delay: 0.25s;
}

.container-item:nth-child(7) {
    animation-delay: 0.3s;
}

.container-item:nth-child(8) {
    animation-delay: 0.35s;
}

@keyframes containerSlideIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.container-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color);
    transform: translateX(5px);
}

.container-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.container-item:hover .container-status-dot {
    transform: scale(1.3);
}

.container-status-dot.running {
    background: var(--status-online);
    box-shadow: 0 0 8px var(--status-online);
    animation: runningPulse 2s ease-in-out infinite;
}

@keyframes runningPulse {

    0%,
    100% {
        box-shadow: 0 0 8px var(--status-online);
    }

    50% {
        box-shadow: 0 0 15px var(--status-online), 0 0 25px var(--status-online);
    }
}

.container-status-dot.stopped {
    background: var(--status-offline);
}

.container-status-dot.paused {
    background: var(--status-warning);
}

.container-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.container-name {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.container-image {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.container-status-text {
    font-size: 0.65rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Container stats animation */
.container-stats {
    animation: containerStatsSlideIn 0.5s ease-out;
}

@keyframes containerStatsSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.container-stat .stat-number {
    animation: countUp 0.8s ease-out;
}

@keyframes countUp {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.container-more {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
    margin-top: var(--spacing-sm);
}

/* ===== Media Grid (Jellyfin) ===== */
.media-scroll-container {
    display: flex;
    flex-direction: row;
    gap: var(--spacing-md);
    overflow-x: auto;
    overflow-y: visible;
    padding: var(--spacing-sm) var(--spacing-xs);
    padding-bottom: var(--spacing-md);
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-tertiary);
    min-height: 240px;
    margin: calc(-1 * var(--spacing-sm)) calc(-1 * var(--spacing-xs));
}

.media-scroll-container::-webkit-scrollbar {
    height: 6px;
}

.media-scroll-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.media-scroll-container::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}

.media-grid {
    display: flex;
    gap: var(--spacing-md);
    overflow-x: auto;
    padding-bottom: var(--spacing-sm);
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-tertiary);
}

.media-card {
    flex-shrink: 0;
    width: 140px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: var(--radius-md);
    perspective: 500px;
}

.media-card:hover {
    transform: scale(1.03) rotateY(-5deg) rotateX(3deg);
    z-index: 10;
}

.media-card:hover .media-poster {
    box-shadow: 0 8px 20px rgba(0, 212, 170, 0.25);
}

.media-poster {
    width: 100%;
    aspect-ratio: 2/3;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: visible;
    margin-bottom: var(--spacing-sm);
    transition: box-shadow 0.3s ease;
    position: relative;
}

.media-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.media-title {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-year {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Media Tooltip - appears on hover */
.media-tooltip {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.8) 50%, transparent 100%);
    padding: var(--spacing-md);
    padding-top: var(--spacing-xl);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    z-index: 20;
}

.media-card:hover .media-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.media-tooltip-title {
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: var(--spacing-xs);
    color: white;
}

.media-tooltip-meta {
    font-size: 0.7rem;
    color: var(--accent-primary);
    margin-bottom: var(--spacing-xs);
}

.media-tooltip-overview {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Request List (Jellyseerr) ===== */
.request-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.request-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
}

.request-item:hover {
    background: var(--bg-card-hover);
    transform: translateX(5px);
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(0, 212, 170, 0.1);
}

.request-poster {
    width: 40px;
    height: 60px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.request-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.request-info {
    flex: 1;
    min-width: 0;
}

.request-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.request-user {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.request-status {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.request-status.pending {
    background: rgba(108, 92, 231, 0.2);
    color: var(--status-pending);
}

.request-status.approved {
    background: rgba(0, 212, 170, 0.2);
    color: var(--status-online);
}

.request-status.declined {
    background: rgba(255, 107, 107, 0.2);
    color: var(--status-offline);
}

/* ===== Settings Panel ===== */
.settings-panel {
    max-width: 600px;
    margin: 0 auto;
}

.settings-panel.hidden {
    display: none;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    backdrop-filter: blur(10px);
}

.settings-card h2 {
    margin-bottom: var(--spacing-sm);
}

.settings-info {
    color: var(--text-muted);
    margin-bottom: var(--spacing-xl);
}

.settings-section {
    margin-bottom: var(--spacing-xl);
}

.settings-section h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
}

.setting-row select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
}

.btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    font-family: inherit;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

/* ===== Error State ===== */
.error-state {
    text-align: center;
    color: var(--text-muted);
    padding: var(--spacing-lg);
}

.error-state svg {
    color: var(--status-offline);
    margin-bottom: var(--spacing-sm);
}

.error-state p {
    margin-bottom: var(--spacing-sm);
}

.retry-btn {
    color: var(--accent-primary);
    background: none;
    border: 1px solid var(--accent-primary);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition-fast);
}

.retry-btn:hover {
    background: rgba(0, 212, 170, 0.1);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: var(--spacing-xl);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .main {
        padding: var(--spacing-md);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .theme-toggle {
        top: var(--spacing-md);
        right: var(--spacing-md);
    }

    .edit-toggle {
        top: var(--spacing-md);
        right: calc(var(--spacing-md) + 52px);
    }
}

/* ===== Edit Mode Toggle ===== */
.edit-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    transition: var(--transition-normal);
}

.edit-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.edit-toggle.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--bg-primary);
}

.edit-toggle.active:hover {
    background: var(--accent-secondary);
}

/* ===== Edit Mode Styles ===== */
body.edit-mode .widget {
    cursor: grab;
    border-style: dashed;
    border-color: var(--accent-primary);
    animation: editPulse 2s ease-in-out infinite;
    opacity: 1 !important;
}

body.edit-mode .widget:hover {
    transform: translateY(-4px);
}

body.edit-mode .widget.dragging {
    cursor: grabbing;
    opacity: 0.7 !important;
    transform: scale(1.02);
}

body.edit-mode .widget.resizing {
    opacity: 0.9 !important;
}

@keyframes editPulse {

    0%,
    100% {
        border-color: var(--accent-primary);
    }

    50% {
        border-color: var(--accent-secondary);
    }
}

/* Default state - no drag/resize when not in edit mode */
body:not(.edit-mode) .widget {
    cursor: default;
}

body:not(.edit-mode) .widget:hover {
    transform: none;
}

body:not(.edit-mode) .resize-handle {
    display: none;
}

/* ===== Resize Handle ===== */
.resize-handle {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    cursor: se-resize;
    color: var(--text-muted);
    opacity: 0;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

body.edit-mode .widget {
    position: relative;
}

body.edit-mode .resize-handle {
    opacity: 0.5;
}

body.edit-mode .widget:hover .resize-handle {
    opacity: 1;
    color: var(--accent-primary);
}

/* Edit mode indicator overlay */
body.edit-mode::after {
    content: 'EDIT MODE';
    position: fixed;
    top: 70px;
    right: var(--spacing-lg);
    background: var(--accent-primary);
    color: var(--bg-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    z-index: 999;
    animation: editBadgePulse 1s ease-in-out infinite;
}

@keyframes editBadgePulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ===== Drag Ghost ===== */
.drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    opacity: 0.8;
    background: var(--bg-card);
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: rotate(2deg);
}

/* Widget in grid */
.widget {
    overflow: visible;
}

/* Ensure widgets fill their grid area */
.dashboard-grid .widget {
    min-height: 100%;
}

/* ===== Widget Placeholder ===== */
.widget-placeholder {
    background: var(--bg-tertiary);
    border: 2px dashed var(--accent-primary);
    border-radius: var(--radius-lg);
    opacity: 0.5;
    min-height: 150px;
}

/* Drop indicators */
.widget.drag-over {
    position: relative;
}

.widget.drag-before::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 4px;
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    animation: dropIndicatorPulse 0.5s ease-in-out infinite;
}

.widget.drag-after::after {
    content: '';
    position: absolute;
    top: 0;
    right: -8px;
    width: 4px;
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    animation: dropIndicatorPulse 0.5s ease-in-out infinite;
}

@keyframes dropIndicatorPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Dragging widget styles */
body.edit-mode .widget.dragging {
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: rotate(2deg);
    cursor: grabbing;
}

/* ===== Mobile Responsive Styles ===== */

/* Tablet and below */
@media (max-width: 768px) {
    :root {
        --spacing-xs: 4px;
        --spacing-sm: 8px;
        --spacing-md: 12px;
        --spacing-lg: 16px;
        --spacing-xl: 20px;
        --header-height: 56px;
    }

    .header {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .header-content {
        gap: var(--spacing-sm);
    }

    .logo {
        height: 36px;
    }

    .nav {
        gap: var(--spacing-xs);
    }

    /* Make nav buttons smaller on tablet */
    .nav-btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.8rem;
    }

    .nav-btn svg {
        width: 16px;
        height: 16px;
    }

    .header-actions {
        gap: var(--spacing-xs);
    }

    .theme-toggle,
    .edit-toggle {
        width: 36px;
        height: 36px;
    }

    .theme-toggle svg,
    .edit-toggle svg {
        width: 18px;
        height: 18px;
    }

    .main {
        padding: var(--spacing-md);
    }

    .widget-header {
        padding: var(--spacing-md);
    }

    .widget-content {
        padding: var(--spacing-md);
    }

    .widget-title span {
        font-size: 0.9rem;
    }

    /* Node stats smaller on tablet */
    .node-stats {
        gap: var(--spacing-xs);
    }

    .stat-value {
        font-size: 1rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    /* Smaller media cards on tablet */
    .media-card {
        width: 120px;
    }

    .media-title {
        font-size: 0.75rem;
    }

    .media-year {
        font-size: 0.65rem;
    }

    /* Request items touch-friendly */
    .request-item {
        padding: var(--spacing-md);
    }

    .footer {
        padding: var(--spacing-md);
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    :root {
        --header-height: 48px;
    }

    .header {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .header-content {
        gap: var(--spacing-xs);
    }

    .logo-container {
        flex-shrink: 0;
    }

    .logo {
        height: 28px;
    }

    .header-right {
        flex: 1;
        justify-content: flex-end;
        gap: var(--spacing-xs);
    }

    .nav {
        gap: var(--spacing-xs);
    }

    /* Icon-only nav buttons on mobile */
    .nav-btn span {
        display: none;
    }

    .nav-btn {
        padding: var(--spacing-xs);
        border-radius: 50%;
        width: 36px;
        height: 36px;
        justify-content: center;
    }

    .nav-btn svg {
        margin: 0;
        width: 16px;
        height: 16px;
    }

    .header-actions {
        gap: var(--spacing-xs);
    }

    .theme-toggle,
    .edit-toggle {
        width: 36px;
        height: 36px;
    }

    .theme-toggle svg,
    .edit-toggle svg {
        width: 16px;
        height: 16px;
    }

    /* Disable widget entrance animations on mobile for performance */
    .widget {
        animation: none;
        opacity: 1;
    }

    /* Smaller widgets on mobile */
    .widget-header {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .widget-title {
        gap: var(--spacing-xs);
    }

    .widget-title svg {
        width: 16px;
        height: 16px;
    }

    .widget-title span {
        font-size: 0.85rem;
    }

    .widget-content {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    /* Node cards full width */
    .node-card {
        padding: var(--spacing-sm);
    }

    .node-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .stat-value {
        font-size: 0.9rem;
    }

    /* Smaller media scroll container */
    .media-scroll-container {
        min-height: 180px;
        gap: var(--spacing-sm);
    }

    .media-card {
        width: 100px;
    }

    /* Request list touch-friendly */
    .request-item {
        padding: var(--spacing-sm);
        gap: var(--spacing-sm);
    }

    .request-poster {
        width: 32px;
        height: 48px;
    }

    .request-title {
        font-size: 0.85rem;
    }

    .request-meta {
        font-size: 0.7rem;
    }

    /* Edit mode badge smaller */
    body.edit-mode::after {
        font-size: 0.6rem;
        padding: 4px 8px;
        top: auto;
        bottom: var(--spacing-md);
        right: var(--spacing-md);
    }

    /* Resize handle larger for touch */
    .resize-handle {
        width: 28px;
        height: 28px;
        bottom: 4px;
        right: 4px;
    }

    /* Footer smaller */
    .footer {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.75rem;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    :root {
        --header-height: 40px;
    }

    .logo {
        height: 24px;
    }

    .nav-btn,
    .theme-toggle,
    .edit-toggle {
        width: 32px;
        height: 32px;
    }

    .nav-btn svg,
    .theme-toggle svg,
    .edit-toggle svg {
        width: 14px;
        height: 14px;
    }

    /* Adjust sticky greeting for very small screens */
    .greeting-widget.sticky {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .greeting-widget.sticky .greeting-text {
        font-size: 0.8rem;
    }

    .greeting-widget.sticky .current-time {
        font-size: 0.7rem;
    }

    .greeting-widget.sticky .mascot {
        transform: scale(0.5);
    }

    .media-card {
        width: 90px;
    }

    .stat-value {
        font-size: 0.8rem;
    }
}

/* Touch device fixes */
@media (hover: none) and (pointer: coarse) {

    /* Remove hover transforms that feel wrong on touch */
    .widget:hover {
        transform: none;
    }

    .media-card:hover {
        transform: none;
    }

    .node-card:hover {
        transform: none;
    }

    .request-item:hover {
        transform: none;
    }

    /* Keep other hover effects like colors */
    .widget:active {
        border-color: var(--accent-primary);
    }

    .media-card:active .media-poster {
        box-shadow: 0 8px 20px rgba(0, 212, 170, 0.25);
    }
}