/* ==========================================================================
   Minecraft Server Info - Design System & Stylesheet
   ========================================================================== */

/* 1. 変数定義 (CSS Custom Properties) */
:root {
    --bg-main: #0c0d12;
    --bg-card: rgba(20, 22, 28, 0.65);
    --bg-card-hover: rgba(26, 29, 38, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(141, 79, 222, 0.4);
    
    /* Minecraftテーマに即したカラーパレット */
    --color-amethyst: #9a5cc6;
    --color-amethyst-light: #b984df;
    --color-emerald: #41cd70;
    --color-emerald-light: #6be092;
    --color-redstone: #ff4747;
    --color-deepslate: #1e1f22;
    --color-netherite: #2d2024;
    
    /* テキストカラー */
    --text-primary: #f5f6f8;
    --text-secondary: #a0a5b5;
    --text-muted: #686d7d;
    
    /* フォントファミリー */
    --font-sans: 'Outfit', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* その他 */
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-glow: 0 0 20px rgba(141, 79, 222, 0.15);
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 2. リセット & グローバルスタイル */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* 3. 背景のアンビエントグローエフェクト */
.ambient-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.12;
    pointer-events: none;
    z-index: -1;
    animation: pulseGlow 12s infinite alternate ease-in-out;
}

.bg-purple {
    background: var(--color-amethyst);
    top: -200px;
    right: -100px;
}

.bg-emerald {
    background: var(--color-emerald);
    bottom: -200px;
    left: -100px;
    animation-delay: -6s;
}

@keyframes pulseGlow {
    0% { transform: scale(1) translate(0, 0); opacity: 0.08; }
    100% { transform: scale(1.2) translate(50px, 50px); opacity: 0.15; }
}

/* 4. ログイン画面のスタイル */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(circle at center, rgba(154, 92, 198, 0.1) 0%, rgba(12, 13, 18, 1) 80%),
        linear-gradient(rgba(12, 13, 18, 0.7), rgba(12, 13, 18, 0.7));
    z-index: 999;
}

/* ポータルのように妖しく光る背景エフェクト */
.login-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: 480px;
    background: var(--color-amethyst);
    filter: blur(120px);
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    box-shadow: var(--shadow-main);
    transition: var(--transition-smooth);
}

.login-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-main), var(--shadow-glow);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.minecraft-logo-icon {
    width: 64px;
    height: 64px;
    background-color: var(--color-amethyst);
    margin: 0 auto 16px;
    border-radius: 12px;
    position: relative;
    /* 草ブロックや立方体のイメージ */
    box-shadow: 
        0 4px 0 #6d3996,
        inset 0 2px 0 rgba(255,255,255,0.2);
    background-image: linear-gradient(135deg, var(--color-amethyst) 0%, #6d3996 100%);
}

.minecraft-logo-icon::after {
    content: 'MC';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 24px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.login-header h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* エラー表示 */
.error-banner {
    background: rgba(255, 71, 71, 0.1);
    border-left: 4px solid var(--color-redstone);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.error-icon {
    color: var(--color-redstone);
    font-weight: bold;
    font-size: 16px;
}

.error-text {
    font-size: 13px;
    color: var(--text-primary);
}

/* フォーム要素 */
.login-form {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.form-group input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    transition: var(--transition-smooth);
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-amethyst);
    box-shadow: 0 0 0 3px rgba(154, 92, 198, 0.2);
}

/* ボタン共通 & プレミアムエフェクト */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-amethyst) 0%, #7e3eb0 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(154, 92, 198, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(154, 92, 198, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary:hover {
    background: #2a2b2f;
    border-color: var(--text-muted);
}

.btn-emerald {
    background: linear-gradient(135deg, var(--color-emerald) 0%, #2bb85b 100%);
    color: #0c0d12;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(65, 205, 112, 0.25);
}

.btn-emerald:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(65, 205, 112, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-block {
    width: 100%;
}

/* ボタンをキラリと光らせるエフェクト */
.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 100%
    );
    transform: skewX(-25deg);
    transition: 0.75s;
    pointer-events: none;
}

.btn:hover .btn-shine {
    left: 125%;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.login-footer p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* 5. ダッシュボードのレイアウト */
.dashboard-body {
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto 30px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo .minecraft-logo-icon {
    width: 36px;
    height: 36px;
    margin: 0;
    border-radius: 8px;
    box-shadow: 0 2px 0 #6d3996;
}

.header-logo .minecraft-logo-icon::after {
    font-size: 14px;
}

.header-logo h1 {
    font-size: 18px;
    font-weight: 700;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-badge {
    background: rgba(65, 205, 112, 0.1);
    color: var(--color-emerald-light);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(65, 205, 112, 0.2);
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-dot {
    width: 6px;
    height: 6px;
    background-color: var(--color-emerald);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--color-emerald);
}

/* グリッドレイアウト */
.dashboard-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    flex-grow: 1;
}

.grid-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

/* カード設計 */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-main);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-main), var(--shadow-glow);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.header-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.card-content {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* 6. 各種カード個別スタイル */

/* 6.1 サーバーステータスカード */
.status-indicator-pulse {
    width: 10px;
    height: 10px;
    background-color: var(--text-muted);
    border-radius: 50%;
    display: inline-block;
    transition: var(--transition-smooth);
}

.status-indicator-pulse.online {
    background-color: var(--color-emerald);
    box-shadow: 0 0 10px var(--color-emerald);
    animation: statusPulse 2s infinite;
}

.status-indicator-pulse.offline {
    background-color: var(--color-redstone);
    box-shadow: 0 0 10px var(--color-redstone);
}

@keyframes statusPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.status-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    gap: 16px;
    color: var(--text-secondary);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-amethyst);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.status-error {
    text-align: center;
    padding: 30px 0;
    color: var(--color-redstone);
}

.status-error p {
    margin-bottom: 16px;
}

.status-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.badge {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 12px;
    text-transform: uppercase;
}

.badge.online {
    background: rgba(65, 205, 112, 0.15);
    color: var(--color-emerald-light);
    border: 1px solid rgba(65, 205, 112, 0.3);
}

.badge.offline {
    background: rgba(255, 71, 71, 0.15);
    color: #ff7676;
    border: 1px solid rgba(255, 71, 71, 0.3);
}

.latency-text {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

.status-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.stat-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

/* MOTD */
.motd-box {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 20px;
}

.motd-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.motd-content {
    font-family: monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #ddd;
    word-break: break-all;
    white-space: pre-wrap;
}

/* プレイヤーリスト */
.players-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 120px;
    overflow-y: auto;
    padding-right: 4px;
}

/* スクロールバー装飾 */
.players-list::-webkit-scrollbar,
.plugin-list-wrapper::-webkit-scrollbar,
.backup-list-wrapper::-webkit-scrollbar {
    width: 6px;
}
.players-list::-webkit-scrollbar-track,
.plugin-list-wrapper::-webkit-scrollbar-track,
.backup-list-wrapper::-webkit-scrollbar-track {
    background: transparent;
}
.players-list::-webkit-scrollbar-thumb,
.plugin-list-wrapper::-webkit-scrollbar-thumb,
.backup-list-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.player-avatar-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--border-color);
}

.player-avatar {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    image-rendering: pixelated; /* ドット絵感を際立たせる */
    background: #333;
}

.player-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 6.2 サーバー情報カード */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.info-value-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.info-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.copy-input-group {
    display: flex;
    gap: 8px;
}

.copy-input-group input {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
}

.copy-input-group input:focus {
    outline: none;
}

/* 6.3 BlueMapカード */
.bluemap-card {
    background-image: 
        radial-gradient(circle at bottom right, rgba(65, 205, 112, 0.1) 0%, rgba(12, 13, 18, 0) 60%);
}

.map-desc {
    font-size: 14px;
    color: var(--text-secondary);
    flex-grow: 1;
}

/* 6.4 プラグイン一覧カード */
.plugin-list-wrapper {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 6px;
}

.plugin-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.plugin-item {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
}

.plugin-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.plugin-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.plugin-version {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.badge-outline {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
}

.plugin-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 6.5 バックアップカード */
.backups-card {
    grid-column: span 3; /* 下部に幅広く表示 */
}

.backups-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.backup-list-wrapper {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 6px;
}

.backup-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.backup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    transition: var(--transition-smooth);
}

.backup-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.02);
}

.backup-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 75%;
}

.backup-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.backup-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.backup-separator {
    color: rgba(255, 255, 255, 0.1);
}

.empty-backups-box {
    text-align: center;
    padding: 40px 20px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.empty-icon {
    font-size: 32px;
}

.empty-backups-box p {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.empty-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* 7. フッター */
.main-footer {
    max-width: 1200px;
    width: 100%;
    margin: 40px auto 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.main-footer p {
    font-size: 12px;
    color: var(--text-muted);
}

/* 8. ユーティリティ & ヘルパークラス */
.hidden {
    display: none !important;
}

.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

/* 9. メディアクエリ (レスポンシブ対応) */
@media (max-width: 992px) {
    .grid-layout {
        grid-template-columns: repeat(2, 1fr);
    }
    .backups-card {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    body {
        padding: 20px 10px;
    }
    
    .main-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
        padding: 20px;
    }
    
    .grid-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .backups-card {
        grid-column: span 1;
    }
    
    .backup-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .backup-info {
        max-width: 100%;
    }
    
    .btn-download {
        width: 100%;
    }
    
    .login-card {
        padding: 30px 20px;
    }
}
