/* Card component family - stat tiles, content cards, player cards, mod cards, timeline cards. */

.dcard {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: background var(--duration-base) var(--ease-out),
                border-color var(--duration-base) var(--ease-out),
                box-shadow var(--duration-base) var(--ease-out),
                transform var(--duration-base) var(--ease-out);
}

.dcard:hover {
    background: var(--card-hover-bg);
    border-color: #2c3646;
    box-shadow: var(--shadow-card-hover);
}

.dcard-body {
    padding: 20px 22px;
}

.dcard-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.dcard-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.dcard-icon svg {
    width: 20px;
    height: 20px;
}

.dcard-icon.tone-green { background: var(--accent-green-10); color: var(--accent-green); }
.dcard-icon.tone-blue { background: var(--accent-blue-10); color: var(--accent-blue); }
.dcard-icon.tone-orange { background: var(--accent-orange-10); color: var(--accent-orange); }
.dcard-icon.tone-red { background: var(--accent-red-10); color: var(--accent-red); }
.dcard-icon.tone-purple { background: var(--accent-purple-10); color: var(--accent-purple); }
.dcard-icon.tone-yellow { background: var(--accent-yellow-10); color: var(--accent-yellow); }

.dcard-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
}

.dcard-subtitle {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: -2px;
}

/* --- Stat tile (row 1 of the dashboard) --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.stat-tile .stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-tile .stat-label {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.stat-tile .stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- Status pill --- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-pill .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-pill.on { background: var(--accent-green-10); color: var(--accent-green); }
.status-pill.on .dot { background: var(--accent-green); box-shadow: 0 0 10px var(--accent-green); }
.status-pill.off { background: rgba(164, 175, 190, 0.10); color: var(--text-secondary); }
.status-pill.off .dot { background: var(--text-secondary); }
.status-pill.transition { background: var(--accent-orange-10); color: var(--accent-orange); }
.status-pill.transition .dot { background: var(--accent-orange); box-shadow: 0 0 10px var(--accent-orange); }
.status-pill.error { background: var(--accent-red-10); color: var(--accent-red); }
.status-pill.error .dot { background: var(--accent-red); box-shadow: 0 0 10px var(--accent-red); }

/* --- Grid layout for the dashboard's rows 2 and 3 --- */
.dash-row {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

.dash-row.cols-3-1-1 { grid-template-columns: 1.6fr 1fr 1fr; }
.dash-row.cols-1-1-1 { grid-template-columns: repeat(3, 1fr); }
.dash-row.cols-2 { grid-template-columns: 1fr 1fr; }

/* --- Avatar glyph (used for player cards - no real avatar image exists) --- */
.avatar-glyph {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(155deg, var(--accent-blue-25), var(--accent-purple-25));
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.avatar-glyph svg {
    width: 20px;
    height: 20px;
    color: var(--text);
    opacity: 0.85;
}

/* --- Player card --- */
.player-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
}

.player-card .player-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-card .player-name {
    font-weight: 600;
    font-size: 15px;
}

.player-card .player-meta {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.player-stat-row {
    display: flex;
    gap: 18px;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.player-stat-row strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.player-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* --- Mod card --- */
.mod-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
}

.mod-card .mod-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    background: var(--accent-purple-10);
    color: var(--accent-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.mod-card .mod-icon svg { width: 22px; height: 22px; }

/* The name/meta block between .mod-icon and .mod-actions has no width of its own - without
   flex:1 it only ever takes its natural text width, so anything positioned after it (status
   pills via ms-auto) lands at a different horizontal spot on every row depending on how long
   that row's mod name happens to be. This targets the actual wrapper div (mod-name/mod-meta's
   parent) regardless of which page's markup it's in - 7D2D/Valheim/Factorio Mods pages all share
   this exact structure. */
.mod-card > div:has(> .mod-name) {
    flex: 1;
    min-width: 0;
}

.mod-card .mod-name {
    font-weight: 600;
    font-size: 15px;
}

.mod-card .mod-meta {
    font-size: 12.5px;
    color: var(--text-secondary);
}

.mod-card .mod-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    flex: none;
}

/* --- Timeline (backups + activity) --- */
.timeline {
    position: relative;
    padding-left: 26px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 18px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -26px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-blue);
    box-shadow: 0 0 0 4px rgba(57, 160, 255, 0.15);
}

.timeline-item.tone-green::before { background: var(--accent-green); box-shadow: 0 0 0 4px var(--accent-green-10); }
.timeline-item.tone-purple::before { background: var(--accent-purple); box-shadow: 0 0 0 4px var(--accent-purple-10); }
.timeline-item.tone-orange::before { background: var(--accent-orange); box-shadow: 0 0 0 4px var(--accent-orange-10); }
.timeline-item.tone-red::before { background: var(--accent-red); box-shadow: 0 0 0 4px var(--accent-red-10); }

.backup-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
}

.backup-card .backup-name {
    font-weight: 600;
    font-size: 14.5px;
    font-family: var(--font-mono);
}

.backup-card .backup-meta {
    font-size: 12.5px;
    color: var(--text-secondary);
}

.backup-card .backup-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    flex: none;
}

.activity-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 13px;
    padding: 4px 0;
}

.activity-row .activity-time {
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: 11.5px;
    flex: none;
    padding-top: 2px;
}

.activity-row .activity-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.activity-row .activity-icon svg { width: 12px; height: 12px; }

.activity-row .activity-message { color: var(--text-secondary); }

/* --- Server tile (hub page /Servers - Steam header art as banner) --- */
.server-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.server-tile {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--card-bg);
    box-shadow: var(--shadow-card);
    transition: transform var(--duration-base) var(--ease-out),
                border-color var(--duration-base) var(--ease-out),
                box-shadow var(--duration-base) var(--ease-out);
}

.server-tile:hover {
    transform: translateY(-3px);
    border-color: #2c3646;
    box-shadow: var(--shadow-card-hover);
}

.server-tile-image {
    position: relative;
    height: 145px;
    background-size: cover;
    background-position: center;
    background-color: #10151c;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.server-tile-image::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 14, 20, 0.05) 0%, rgba(10, 14, 20, 0.25) 45%, rgba(10, 14, 20, 0.95) 100%);
}

.server-tile-status {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    backdrop-filter: blur(6px);
}

.server-tile-heading {
    position: relative;
    z-index: 1;
    padding: 0 16px 12px;
}

.server-tile-title {
    font-size: 15.5px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.server-tile-subtitle {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.server-tile-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 12.5px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
}

.server-tile-footer svg {
    width: 15px;
    height: 15px;
    flex: none;
}

@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-row.cols-3-1-1,
    .dash-row.cols-1-1-1,
    .dash-row.cols-2 { grid-template-columns: 1fr; }
}

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