/* =============================================
   Minecraft Server Hub - Main Styles
   ============================================= */

:root {
    /* Dark theme colors */
    --bg-primary: #0d0d0d;
    --bg-secondary: #111111;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222222;

    /* Accent colors */
    --accent-green: #22c55e;
    --accent-blue: #3b82f6;
    --accent-purple: #a855f7;
    --accent-orange: #f97316;
    --accent-red: #ef4444;
    --accent-yellow: #eab308;
    --accent-cyan: #22d3d8;
    --accent-pink: #f472b6;

    /* Text colors */
    --text-primary: #ededed;
    --text-secondary: #888888;
    --text-muted: #666666;

    /* Borders */
    --border-color: #2a2a2a;
    --border-color-2: #333333;
    --border-radius: 8px;
    --border-radius-sm: 6px;

    /* Fonts */
    --sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'Geist Mono', 'Monaco', 'Consolas', monospace;

    /* Shadows */
    --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.4);

    /* Transitions */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: all 0.12s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-medium: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);

    /* Focus */
    --focus-ring: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--border-color-2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

/* =============================================
   Focus & Accessibility
   ============================================= */

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    box-shadow: none;
    border-color: var(--border-color-2);
}

/* =============================================
   Custom Scrollbar
   ============================================= */

::-webkit-scrollbar {
    width: 3px;
    height: 3px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Shared Card Depth — removed for flat design */

/* =============================================
   Hub Container
   ============================================= */

.hub-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* =============================================
   Header
   ============================================= */

.hub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.server-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.server-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.server-icon img {
    border-radius: calc(var(--border-radius) * 1);
}

.server-details h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-red);
}

.status-dot.online {
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.status-text {
    font-weight: 500;
}

.player-count {
    color: var(--text-muted);
    padding-left: 8px;
    border-left: 1px solid var(--border-color);
}

.player-count-link {
    text-decoration: none;
    color: inherit;
}

.player-count-link:hover .player-count {
    color: var(--accent-cyan);
    text-decoration: underline;
}

.quick-actions {
    display: flex;
    gap: 12px;
}

.btn-power {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--accent-green);
    background: transparent;
    color: var(--accent-green);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-power svg {
    width: 24px;
    height: 24px;
}

.btn-power:hover {
    background: var(--accent-green);
    color: var(--bg-primary);
}

/* Power button states */
.btn-power.online {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.btn-power.online:hover {
    background: var(--accent-red);
    color: var(--bg-primary);
}

.btn-power.offline {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.btn-power.offline:hover {
    background: var(--accent-green);
    color: var(--bg-primary);
}

.btn-power.starting,
.btn-power.stopping {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
    pointer-events: none;
    opacity: 0.7;
}

/* Restart button */
.btn-restart {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
    background: transparent;
    color: var(--accent-blue);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-restart svg {
    width: 22px;
    height: 22px;
}

.btn-restart:hover {
    background: var(--accent-blue);
    color: var(--bg-primary);
}

.btn-restart:disabled {
    border-color: var(--text-muted);
    color: var(--text-muted);
    pointer-events: none;
    opacity: 0.5;
}

/* =============================================
   Stats Bar
   ============================================= */

.stats-bar {
    display: flex;
    height: 44px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    padding: 0 20px;
    border-right: 1px solid var(--border-color);
    position: relative;
}

.stat-item:last-child {
    border-right: none;
}

.stat-label {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    flex-shrink: 0;
}

.stat-bar {
    flex: 1;
    height: 3px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: 2px;
    transition: width 0.5s var(--ease-out-expo);
}

.stat-fill.warning {
    background: var(--accent-orange);
}

.stat-fill.danger {
    background: var(--accent-red);
}

.stat-value {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.tps-good {
    color: var(--accent-green);
}

.tps-warn {
    color: var(--accent-orange);
}

.tps-bad {
    color: var(--accent-red);
    animation: tpsPulse 1.5s ease-in-out infinite;
}

@keyframes tpsPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* =============================================
   Page Title Row (Dashboard)
   ============================================= */

.page-title-row {
    margin-bottom: 24px;
}

.page-title-row h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* =============================================
   Hub Grid
   ============================================= */

.hub-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    flex: 1;
}

/* =============================================
   Hub Cards
   ============================================= */

.hub-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-top: 2px solid var(--border-color);
    transition: var(--transition-medium);
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 160px;
}

.hub-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-2);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Contextual border-top accent on hover */
.hub-card.console:hover  { border-top-color: var(--accent-green); }
.hub-card.files:hover    { border-top-color: var(--accent-yellow); }
.hub-card.permissions:hover { border-top-color: var(--accent-red); }
.hub-card.players:hover  { border-top-color: var(--accent-blue); }
.hub-card.database:hover { border-top-color: var(--accent-green); }
.hub-card.plugins:hover  { border-top-color: var(--accent-blue); }
.hub-card.backups:hover  { border-top-color: var(--accent-green); }
.hub-card.schedule:hover { border-top-color: var(--accent-purple); }
.hub-card.logs:hover     { border-top-color: var(--accent-yellow); }
.hub-card.notifications:hover { border-top-color: var(--accent-yellow); }
.hub-card.settings:hover { border-top-color: var(--accent-purple); }
.hub-card.security:hover { border-top-color: var(--accent-yellow); }

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

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

/* Icon backgrounds — colourful */
.hub-card.console .card-icon { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.hub-card.files .card-icon { background: rgba(234, 179, 8, 0.15); color: var(--accent-yellow); }
.hub-card.permissions .card-icon { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.hub-card.players .card-icon { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.hub-card.database .card-icon { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.hub-card.plugins .card-icon { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.hub-card.backups .card-icon { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.hub-card.schedule .card-icon { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.hub-card.logs .card-icon { background: rgba(234, 179, 8, 0.15); color: var(--accent-yellow); }
.hub-card.notifications .card-icon { background: rgba(234, 179, 8, 0.15); color: var(--accent-yellow); }
.hub-card.settings .card-icon { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.hub-card.security .card-icon { background: rgba(234, 179, 8, 0.15); color: var(--accent-yellow); }

.card-content h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.card-content p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Card badges */
.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

.card-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: transparent;
}

.card-badge.green {
    color: var(--accent-green);
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.08);
}

.card-badge.blue {
    color: var(--accent-blue);
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.08);
}

.card-badge.orange {
    color: var(--accent-orange);
    border-color: rgba(249, 115, 22, 0.3);
    background: rgba(249, 115, 22, 0.08);
}

.card-badge.yellow {
    color: var(--accent-yellow);
    border-color: rgba(234, 179, 8, 0.3);
    background: rgba(234, 179, 8, 0.08);
}

.card-badge.purple {
    color: var(--accent-purple);
    border-color: rgba(168, 85, 247, 0.3);
    background: rgba(168, 85, 247, 0.08);
}

/* Skeleton badge for loading state */
.skeleton-badge {
    height: 20px;
    width: 60px;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    display: inline-block;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Card previews removed — using card-badges instead */

/* =============================================
   Page Content Fade-in
   ============================================= */

@keyframes fadeInPage {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-content {
    animation: fadeInPage 0.3s var(--ease-out-expo) both;
}

/* =============================================
   Responsive
   ============================================= */

@media (max-width: 1100px) {
    .hub-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-bar {
        flex-direction: column;
        height: auto;
    }

    .stat-item {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 8px 16px;
    }

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

    .hub-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hub-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
        padding: 16px;
    }

    .quick-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .hub-container {
        padding: 16px;
    }

    .hub-card {
        min-height: 140px;
    }

    .server-details h1 {
        font-size: 1.25rem;
    }
}

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

    .hub-card {
        min-height: auto;
        padding: 16px;
    }
}

/* =============================================
   Accessibility: Reduced Motion
   ============================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .page-content {
        animation: none;
    }

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