/* =================================
   WP Valheim Server Status - Frontend CSS (Improved)
   ================================= */

   :root {
    --valheim-primary: #2c3e50;
    --valheim-secondary: #34495e;
    --valheim-accent: #e74c3c;
    --valheim-success: #27ae60;
    --valheim-warning: #f39c12;
    --valheim-info: #3498db;
    --valheim-light: #ecf0f1;
    --valheim-dark: #2c3e50;
    --valheim-muted: #7f8c8d;
    --valheim-border: #bdc3c7;
    --valheim-shadow: rgba(0,0,0,0.1);
    --valheim-gold: #d4af37;
    --valheim-bronze: #cd7f32;
    
    /* Valheim-inspired color palette */
    --valheim-bg-primary: #2a2016;
    --valheim-bg-secondary: #3d3426;
    --valheim-text-primary: #f4e4bc;
    --valheim-text-secondary: #d4af37;
    --valheim-gradient-primary: linear-gradient(135deg, #cd7f32 0%, #d4af37 100%);
    --valheim-gradient-secondary: linear-gradient(135deg, #8b4513 0%, #cd7f32 100%);
    --valheim-gradient-success: linear-gradient(135deg, #daa520 0%, #ffd700 100%);
    --valheim-wood: #8b4513;
    --valheim-stone: #696969;
    --valheim-amber: #ffbf00;
}

/* =================================
   Base Styles
   ================================= */

.wp-valheim-server-status {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: var(--valheim-bg-secondary);
    border: 3px solid var(--valheim-bronze);
    border-radius: 8px;
    padding: 0;
    margin: 20px 0;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4), 
                inset 0 1px 0 rgba(212, 175, 55, 0.3);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
    color: var(--valheim-text-primary);
}

.wp-valheim-server-status::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(205, 127, 50, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.wp-valheim-server-status:hover {
    box-shadow: 0 12px 35px rgba(0,0,0,0.5), 
                inset 0 1px 0 rgba(212, 175, 55, 0.4),
                0 0 20px rgba(212, 175, 55, 0.2);
    transform: translateY(-3px);
    border-color: var(--valheim-gold);
}

/* =================================
   Header Styles
   ================================= */

.wp-valheim-header {
    background: var(--valheim-gradient-primary);
    color: var(--valheim-text-primary);
    padding: 24px;
    margin-bottom: 0;
    border-bottom: 2px solid var(--valheim-bronze);
    position: relative;
    overflow: hidden;
}

.wp-valheim-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(139, 69, 19, 0.1) 2px,
            rgba(139, 69, 19, 0.1) 4px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(139, 69, 19, 0.1) 2px,
            rgba(139, 69, 19, 0.1) 4px
        );
    pointer-events: none;
}

.wp-valheim-status-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.wp-valheim-status-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
    border: 3px solid rgba(139, 69, 19, 0.3);
}

.wp-valheim-status-dot.online {
    background-color: #00ff88;
    box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.4),
                inset 0 2px 4px rgba(0,0,0,0.2);
}

.wp-valheim-status-dot.offline {
    background-color: #ff4757;
    box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4),
                inset 0 2px 4px rgba(0,0,0,0.2);
    animation: none;
}

.wp-valheim-status-text {
    font-weight: 700;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--valheim-text-primary);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.wp-valheim-server-name {
    font-size: 42px;
    font-weight: 700;
    color: var(--valheim-text-primary);
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    position: relative;
    z-index: 1;
}

/* =================================
   Content Area
   ================================= */

.wp-valheim-content {
    padding: 24px;
    background: var(--valheim-bg-secondary);
    display: grid;
    gap: 24px;
    position: relative;
    z-index: 1;
}

.wp-valheim-main-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* =================================
   Player Count Section
   ================================= */

.wp-valheim-player-count-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--valheim-gradient-success);
    color: var(--valheim-bg-primary);
    padding: 32px 24px;
    border-radius: 8px;
    border: 2px solid var(--valheim-bronze);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3),
                0 4px 8px rgba(0,0,0,0.2);
}

.wp-valheim-player-count-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle, rgba(139, 69, 19, 0.2) 0%, transparent 70%),
        conic-gradient(from 0deg, transparent, rgba(212, 175, 55, 0.1), transparent);
    animation: rotate 30s linear infinite;
    pointer-events: none;
}

.wp-valheim-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.wp-valheim-stat-value {
    font-size: 42px;
    font-weight: 800;
    line-height: 1;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    color: var(--valheim-bg-primary);
}

.wp-valheim-stat-label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    margin-top: 4px;
    color: var(--valheim-bg-primary);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.wp-valheim-stat-separator {
    font-size: 32px;
    font-weight: 200;
    color: var(--valheim-bg-primary);
    position: relative;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* =================================
   Server Details
   ================================= */

.wp-valheim-server-details {
    background: var(--valheim-bg-primary);
    padding: 24px;
    border-radius: 8px;
    border: 2px solid var(--valheim-wood);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3),
                0 4px 8px rgba(0,0,0,0.2);
}

.wp-valheim-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.wp-valheim-detail {
    background: var(--valheim-bg-secondary);
    padding: 16px;
    border-radius: 6px;
    border: 1px solid var(--valheim-bronze);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wp-valheim-detail:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    border-color: var(--valheim-gold);
}

.wp-valheim-detail-label {
    font-weight: 600;
    color: var(--valheim-text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wp-valheim-detail-value {
    font-weight: 700;
    color: var(--valheim-text-primary);
    font-size: 18px;
    word-break: break-word;
}

/* =================================
   Players Section
   ================================= */

.wp-valheim-players-section {
    background: var(--valheim-bg-secondary);
    border: 2px solid var(--valheim-bronze);
    border-radius: 8px;
    padding: 24px;
    margin-top: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.wp-valheim-players-section h4 {
    margin: 0 0 20px 0;
    color: var(--valheim-text-primary);
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--valheim-bronze);
}

.wp-valheim-players-section h4::before {
    content: '👥';
    font-size: 18px;
}

.wp-valheim-players-list {
    display: grid;
    gap: 10px;
}

.wp-valheim-player {
    background: linear-gradient(135deg, var(--valheim-bg-primary) 0%, rgba(42, 32, 22, 0.8) 100%);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--valheim-gold);
    border: 2px solid var(--valheim-wood);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.wp-valheim-player::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(212, 175, 55, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(205, 127, 50, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.wp-valheim-player:hover {
    transform: translateX(8px) translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    border-left-color: var(--valheim-amber);
    border-color: var(--valheim-gold);
}

.wp-valheim-player-name {
    font-weight: 700;
    color: var(--valheim-text-primary);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    position: relative;
    z-index: 1;
    padding: 0 8px 0 30px;
}

.wp-valheim-player-name::before{
    content: '👤';
    position: absolute;
    left:2px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    line-height: 1;
    opacity: .9;
}

.wp-valheim-player-ping {
    background: var(--valheim-success);
    color: white;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.wp-valheim-player-name .wp-valheim-player-ping::before{
  content: '📶';
  font-size: 12px;
}

.wp-valheim-player-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    position: relative;
    z-index: 1;
}

.wp-valheim-player-biome,
.wp-valheim-player-playtime {
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
    padding: 0 8px 0 30px;
}

.wp-valheim-biome-label,
.wp-valheim-playtime-label {
    color: var(--valheim-text-secondary);
    font-weight: 600;
    display: block;
    margin-bottom: 12px;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wp-valheim-player-biome::before {
    content: '🗺️';
    position: absolute;
    left:2px;
    top: 30%;
    transform: translateY(-50%);
    font-size: 16px;
    line-height: 1;
    opacity: .9;
}

.wp-valheim-player-playtime::before {
    content: '⏱️';
    position: absolute;
    left:-3px;
    top: 25%;
    transform: translateY(-50%);
    font-size: 20px;
    line-height: 1;
    opacity: .9;
}

.wp-valheim-biome-name {
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    text-transform: capitalize;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.wp-valheim-biome-meadows::before {
  content: '🌳 ';
}
.wp-valheim-biome-blackforest::before {
  content: '🌲 ';
}
.wp-valheim-biome-swamp::before {
  content: '💀 ';
}
.wp-valheim-biome-mountain::before {
  content: '🏔️ ';
}
.wp-valheim-biome-plains::before {
  content: '🏝️ ';
}
.wp-valheim-biome-ocean::before {
  content: '🌊 ';
}
.wp-valheim-biome-mistlands::before {
  content: '🌫️ ';
}
.wp-valheim-biome-ashlands::before {
  content: '🔥 ';
}
.wp-valheim-biome-deepnorth::before {
  content: '❄️ ';
}


/* Biome-specific colors */
.wp-valheim-biome-meadows { background: #7cb342; color: white; }
.wp-valheim-biome-blackforest { background: #2e7d32; color: white; }
.wp-valheim-biome-swamp { background: #5d4037; color: white; }
.wp-valheim-biome-mountain { background: #546e7a; color: white; }
.wp-valheim-biome-plains { background: #ffa726; color: white; }
.wp-valheim-biome-ocean { background: #1976d2; color: white; }
.wp-valheim-biome-mistlands { background: #7b1fa2; color: white; }
.wp-valheim-biome-ashlands { background: #d32f2f; color: white; }
.wp-valheim-biome-deepnorth { background: #0277bd; color: white; }

.wp-valheim-playtime-value {
    font-weight: 700;
    color: var(--valheim-text-primary);
    font-size: 16px;
}

/* =================================
   Mods Section
   ================================= */

.wp-valheim-mods-section {
    margin-top: 15px;
}

.wp-valheim-mods-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--valheim-gradient-secondary);
    color: var(--valheim-text-primary);
    padding: 12px 20px;
    border-radius: 8px;
    border: 2px solid var(--valheim-bronze);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.wp-valheim-mods-header:hover {
    background: var(--valheim-gradient-primary);
    border-color: var(--valheim-gold);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.wp-valheim-mods-header h5 {
    margin: 0;
    color: var(--valheim-text-primary);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wp-valheim-mods-count {
    margin-left: 12px;
    background: rgba(139, 69, 19, 0.3);
    color: var(--valheim-text-primary);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    border: 1px solid var(--valheim-bronze);
}

.wp-valheim-mods-toggle {
    font-size: 18px;
    transition: transform 0.2s ease;
    color: var(--valheim-text-primary);
}

.wp-valheim-mods-toggle.collapsed {
    transform: rotate(-90deg);
}

.wp-valheim-mods-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    max-height: 1000px; /* Large enough for any reasonable number of mods */
    overflow: hidden;
    opacity: 1;
    padding: 4px;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out;
}

.wp-valheim-mods-list.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
}

.wp-valheim-mod {
    background: linear-gradient(135deg, var(--valheim-wood), var(--valheim-bronze));
    color: var(--valheim-text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--valheim-bronze);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
    word-break: break-word;
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.wp-valheim-mod:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, var(--valheim-bronze), var(--valheim-gold));
    border-color: var(--valheim-gold);
}

/* =================================
   Footer
   ================================= */

.wp-valheim-footer {
    margin-top: 0;
    padding: 20px 24px;
    border-top: 2px solid var(--valheim-bronze);
    text-align: center;
    background: var(--valheim-bg-primary);
    border-radius: 0 0 8px 8px;
}

.wp-valheim-last-update {
    color: var(--valheim-text-secondary);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wp-valheim-last-update::before {
    content: '🕒';
    font-size: 14px;
}

/* =================================
   Compact Layout
   ================================= */

.wp-valheim-compact {
    padding: 15px;
    margin: 10px 0;
}

.wp-valheim-compact-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wp-valheim-compact-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wp-valheim-compact .wp-valheim-server-name {
    font-size: 16px;
    margin: 0;
}

.wp-valheim-compact-players {
    font-weight: 600;
    color: var(--valheim-primary);
}

/* =================================
   Error States
   ================================= */

.wp-valheim-error {
    background: var(--valheim-accent);
    color: white;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
}

.wp-valheim-no-players {
    text-align: center;
    color: var(--valheim-muted);
    font-style: italic;
    padding: 20px;
}

/* =================================
   Dark Theme
   ================================= */

.wp-valheim-theme-dark {
    background: var(--valheim-dark);
    color: var(--valheim-light);
    border-color: var(--valheim-secondary);
}

.wp-valheim-theme-dark .wp-valheim-header {
    border-bottom-color: var(--valheim-secondary);
}

.wp-valheim-theme-dark .wp-valheim-server-name {
    color: var(--valheim-light);
}

.wp-valheim-theme-dark .wp-valheim-server-details {
    background: var(--valheim-secondary);
}

.wp-valheim-theme-dark .wp-valheim-detail-value {
    color: var(--valheim-light);
}

.wp-valheim-theme-dark .wp-valheim-players-section {
    background: var(--valheim-secondary);
    border-color: var(--valheim-primary);
}

.wp-valheim-theme-dark .wp-valheim-player {
    background: var(--valheim-primary);
}

.wp-valheim-theme-dark .wp-valheim-player:hover {
    background: #34495e;
}

.wp-valheim-theme-dark .wp-valheim-player-name {
    color: var(--valheim-light);
}

/* =================================
   Minimal Theme
   ================================= */

.wp-valheim-theme-minimal {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 10px;
}

.wp-valheim-theme-minimal .wp-valheim-header {
    border-bottom: none;
    margin-bottom: 10px;
}

.wp-valheim-theme-minimal .wp-valheim-server-details {
    background: transparent;
    padding: 0;
}

.wp-valheim-theme-minimal .wp-valheim-detail {
    border-bottom: 1px solid var(--valheim-border);
}

/* =================================
   Valheim Theme
   ================================= */

.wp-valheim-theme-valheim {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: var(--valheim-gold);
    border: 2px solid var(--valheim-bronze);
    position: relative;
}

.wp-valheim-theme-valheim::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--valheim-bronze), var(--valheim-gold), var(--valheim-bronze));
}

.wp-valheim-theme-valheim .wp-valheim-server-name {
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.wp-valheim-theme-valheim .wp-valheim-player-count-section {
    background: linear-gradient(135deg, var(--valheim-bronze), var(--valheim-gold));
}

.wp-valheim-theme-valheim .wp-valheim-server-details {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid var(--valheim-bronze);
}

/* =================================
   Divi Module Specific
   ================================= */

.wp-valheim-divi-module {
    font-family: inherit;
}

.wp-valheim-divi-compact {
    padding: 10px 15px;
}

.wp-valheim-status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
}

.wp-valheim-divi-minimal {
    text-align: center;
    padding: 15px;
}

.wp-valheim-minimal-status {
    margin-bottom: 8px;
}

.wp-valheim-status-indicator {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wp-valheim-status-indicator.online {
    background: var(--valheim-success);
    color: white;
}

.wp-valheim-status-indicator.offline {
    background: var(--valheim-accent);
    color: white;
}

.wp-valheim-minimal-count {
    font-size: 14px;
    color: var(--valheim-muted);
}

/* =================================
   Animations
   ================================= */

.wp-valheim-animated {
    transition: all 0.3s ease;
}

.wp-valheim-animated .wp-valheim-player {
    transition: all 0.2s ease;
}

.wp-valheim-animated .wp-valheim-status-dot {
    transition: all 0.3s ease;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(39, 174, 96, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wp-valheim-fade-in {
    animation: fadeInUp 0.6s ease-out;
}

/* =================================
   Responsive Design
   ================================= */

@media (max-width: 768px) {
    .wp-valheim-server-status {
        padding: 15px;
        margin: 15px 0;
    }
    
    .wp-valheim-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .wp-valheim-server-name {
        text-align: left;
        font-size: 20px;
    }
    
    .wp-valheim-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .wp-valheim-detail {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .wp-valheim-player-count-section {
        padding: 15px;
    }
    
    .wp-valheim-stat-value {
        font-size: 24px;
    }
    
    .wp-valheim-compact-content {
        flex-direction: column;
        gap: 8px;
    }
    
    .wp-valheim-status-row {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .wp-valheim-server-status {
        padding: 12px;
        margin: 10px 0;
    }
    
    .wp-valheim-mods-list {
        gap: 4px;
    }
    
    .wp-valheim-mod {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .wp-valheim-player {
        padding: 10px;
    }
}
