:root {
    --bg-color: #050505;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(255, 255, 255, 0.2);
    --accent: #6b21a8; /* Deep purple */
    --accent-glow: rgba(107, 33, 168, 0.5);
    
    --jellyfin-color: #aa5cc3;
    --comfyui-color: #3b82f6;
    --comfyui2-color: #10b981;
    --sonarr-color: #00c2ff;
    --radarr-color: #ffc230;
    --upsnap-color: #ef4444;
    --twai-color: #00a4ef;
    --qnap-color: #0099cc;
    --qbittorrent-color: #2d79c7;
    --prowlarr-color: #f5a623;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #111 0%, #000 100%);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: #6b21a8;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: #2563eb;
    bottom: -50px;
    right: -100px;
    animation-delay: -5s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: #10b981;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
    opacity: 0.3;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Main Container */
.container {
    width: 100%;
    max-width: 1200px;
    padding: 40px;
    z-index: 1;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
    background: rgba(0, 0, 0, 0.3);
    padding: 24px 32px;
    border-radius: 24px;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(to right, #fff, #a0a0a0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
    margin-top: 4px;
}

.header-right {
    text-align: right;
}

/* World Clocks */
.world-clocks {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 40px;
    padding: 24px 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.world-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.world-clock:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 10%;
    height: 80%;
    width: 1px;
    background: var(--card-border);
}

.world-clock-name {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.world-clock-time {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -1px;
}

.world-clock-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Exchange Rate Widget */
.exchange-rate-widget {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 40px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.exchange-rate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.exchange-rate-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.sync-rate-btn {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sync-rate-btn:hover {
    background: rgba(59, 130, 246, 0.4);
}

.current-rate {
    font-size: 2rem;
    font-weight: 800;
    color: #10b981; /* Green color for positive vibe */
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

/* Cards */
.card {
    text-decoration: none;
    color: inherit;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 32px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: block;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(800px circle at var(--mouse-x) var(--mouse-y), rgba(255,255,255,0.06), transparent 40%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

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

.card:hover {
    transform: translateY(-8px);
    border-color: var(--card-hover-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.card-content {
    position: relative;
    z-index: 2;
}

/* Icons */
.icon-container {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
    transition: transform 0.3s ease;
}

.card:hover .icon-container {
    transform: scale(1.1);
}

/* Specific Service Colors */
.jellyfin { background: rgba(170, 92, 195, 0.2); color: var(--jellyfin-color); box-shadow: 0 0 20px rgba(170, 92, 195, 0.2); }
.comfyui { background: rgba(59, 130, 246, 0.2); color: var(--comfyui-color); box-shadow: 0 0 20px rgba(59, 130, 246, 0.2); }
.comfyui2 { background: rgba(16, 185, 129, 0.2); color: var(--comfyui2-color); box-shadow: 0 0 20px rgba(16, 185, 129, 0.2); }
.sonarr { background: rgba(0, 194, 255, 0.2); color: var(--sonarr-color); box-shadow: 0 0 20px rgba(0, 194, 255, 0.2); }
.radarr { background: rgba(255, 194, 48, 0.2); color: var(--radarr-color); box-shadow: 0 0 20px rgba(255, 194, 48, 0.2); }
.upsnap { background: rgba(239, 68, 68, 0.2); color: var(--upsnap-color); box-shadow: 0 0 20px rgba(239, 68, 68, 0.2); }
.twai { background: rgba(0, 164, 239, 0.2); color: var(--twai-color); box-shadow: 0 0 20px rgba(0, 164, 239, 0.2); }
.qnap { background: rgba(0, 153, 204, 0.2); color: var(--qnap-color); box-shadow: 0 0 20px rgba(0, 153, 204, 0.2); }
.qbittorrent { background: rgba(45, 121, 199, 0.2); color: var(--qbittorrent-color); box-shadow: 0 0 20px rgba(45, 121, 199, 0.2); }
.prowlarr { background: rgba(245, 166, 35, 0.2); color: var(--prowlarr-color); box-shadow: 0 0 20px rgba(245, 166, 35, 0.2); }

/* Typography inside cards */
.card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 300;
}

/* Power Buttons */
.power-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
    backdrop-filter: blur(5px);
}

.btn-wol {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.btn-wol:hover {
    background: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.btn-shutdown {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-shutdown:hover {
    background: rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .header-right {
        text-align: center;
    }
    
    .container {
        padding: 20px;
    }
}

/* Status Indicator */
.status-indicator {
    position: absolute;
    top: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #555; /* Default loading/unknown state */
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.status-dot.online {
    background-color: #10b981; /* Green */
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.status-dot.offline {
    background-color: #ef4444; /* Red */
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.status-dot.loading {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.5; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0.5; transform: scale(0.9); }
}

/* Edit Mode UI */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
    padding: 8px;
}

.icon-btn:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

.edit-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 40px;
}

.hidden {
    display: none !important;
}

.card.edit-mode {
    cursor: default;
    pointer-events: none;
}

.card.edit-mode .card-content {
    pointer-events: none;
}

.card.edit-mode .status-indicator {
    display: none;
}

/* Edit controls on card */
.card-edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: auto;
    display: none;
}

.card.edit-mode .card-edit-overlay {
    display: block;
}

.remove-card-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

.edit-card-btn {
    position: absolute;
    top: 12px;
    right: 52px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

.move-card-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.move-card-btn:hover {
    background: rgba(255,255,255,0.4);
}

.move-card-left { left: 10px; }
.move-card-right { right: 10px; }



/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-content h2 {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--card-border);
    color: white;
    font-family: inherit;
    font-size: 1rem;
}

.modal-actions {
    display: flex;
    gap: 16px;
    margin-top: 32px;
}

.btn-save {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.btn-save:hover {
    background: rgba(16, 185, 129, 0.4);
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}
