/* ==========================================================================
   快乐农场 - 布局容器与顶部导航 (layout.css)
   ========================================================================== */

/* ==========================================================================
   1. 布局容器 (Layout Containers)
   ========================================================================== */

/* 全宽背景区块 
 * 用于“田地”和“商店”等大板块的背景图容器
 */
.full-width-section {
    width: 100%;       
    min-height: 60vh;            /* 至少占据 60% 视口高度 */
    position: relative;
    background-size: cover;      /* 背景图自适应覆盖 */
    background-position: center; 
    background-repeat: no-repeat;
    padding: 40px 0;
    border-bottom: 5px solid rgba(255,255,255,0.3); /* 底部装饰线 */
    margin-bottom: 20px; 
}

/* 具体背景图设置 */
#section-fields {
    background-image: url('../assets/tiandi.jpeg'); 
}

#section-shop {
    background-image: url('../assets/shangdian.jpeg');
}

/* 游戏内容限制容器
 * 限制最大宽度，确保在大屏幕上内容不会散得太开，保持居中
 */
.game-content-wrapper {
    width: var(--game-width);
    max-width: 1400px;
    margin: 0 auto; /* 水平居中 */
    box-sizing: border-box;
}

/* 玻璃拟态面板 (Glassmorphism)
 * 用于商店、田地容器，营造现代感
 */
.glass-panel {
    background: rgba(255, 255, 255, 0.9); /* 高透明度白色 */
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); /* 柔和阴影 */
    backdrop-filter: blur(5px);           /* 背景模糊核心属性 */
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* 板块标题 (如 "田地", "商店") */
.section-title {
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5); /* 增加文字投影，防止背景太亮看不清 */
    background: rgba(0, 0, 0, 0.4);         /* 半透明黑底 */
    padding: 10px 20px;
    border-radius: 8px;
    display: inline-block;
    margin-top: 0;
    border-bottom: none;
}

/* 通用网格容器 (用于商店物品排列等) */
.grid-container {
    display: flex;
    flex-wrap: wrap; /* 允许换行 */
    gap: 15px;       /* 元素间距 */
}

/* ==========================================================================
   2. 顶部 UI 组件 (Header UI) - 居中且防遮挡版
   ========================================================================== */

/* 顶部状态栏 (金币、功能按钮)
 * 固定定位，始终显示在顶部
 */
#stats-container {
    position: fixed;
    top: 20px;
    
    /* 核心修改：恢复居中 */
    left: 50%; 
    transform: translateX(-50%); 
    
    /* 关键计算：两边留白 
       为了视觉居中，左右必须留出相等的空隙。
       右侧背包按钮大约占 70px 空间。
       为了安全，我们设定左右各留 90px (共 180px)。
       这样既保证了居中，右边又绝对不会碰到背包按钮。
    */
    width: calc(100% - 180px); 
    max-width: 1000px; /* 限制最大宽度，大屏更精致 */
    
    height: 70px;
    padding: 0 25px;
    
    /* 视觉升级 */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255,255,255,0.8);
    
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.stats-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

/* 优化里面的按钮组 */
#free-mode-controls button,
#focus-mode-controls button {
    border-radius: 20px !important;
    padding: 8px 15px !important;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.1s, box-shadow 0.1s;
    white-space: nowrap; 
}

#free-mode-controls {
    display: flex;
    gap: 8px;
}

#focus-mode-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 72%;
}

.focus-plan-preview {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 18px;
    background: rgba(111, 66, 193, 0.1);
    border: 1px solid rgba(111, 66, 193, 0.18);
    color: #4b2e83;
    font-size: 0.85em;
    font-weight: 700;
    line-height: 1.35;
    white-space: normal !important;
}

.focus-plan-preview .plan-label {
    color: #6f42c1;
}

.focus-plan-preview .plan-detail {
    color: #2f2a3d;
}

#free-mode-controls button:active {
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

#stats-container div {
    font-size: 1.1em;
    font-weight: bold;
    white-space: nowrap;
}

#money-display {
    color: #28a745;
    font-size: 1.1em;
}

/* 针对笔记本和小屏幕的适配 */
@media (max-width: 1200px) {
    #stats-container {
        /* 在较窄屏幕上，稍微收缩两边的留白以容纳更多内容
           左右各留 75px (共 150px)，依然足够避开背包按钮
        */
        width: calc(100% - 150px); 
        padding: 0 15px;
        height: 60px; /* 变矮一点 */
        top: 15px;
    }
    
    #free-mode-controls button,
    #focus-mode-controls button {
        padding: 6px 12px !important;
        font-size: 0.85em;
    }

    #focus-mode-controls {
        max-width: 78%;
        gap: 8px;
    }

    .focus-plan-preview {
        font-size: 0.78em;
        padding: 6px 10px;
    }
    #stats-container div {
        font-size: 1em;
    }
}

/* 专注模式准备条 */
#focus-prep-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: #6f42c1;
    color: white;
    z-index: 999;
    padding: 10px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

.prep-info {
    font-size: 1.1em;
}

.prep-actions {
    display: flex;
    gap: 10px;
}

/* ==========================================================================
   3. 专注模式全局覆盖样式 (Focus Mode Overrides)
   ========================================================================== */

/* 专注模式激活时的 Body 样式 */
body.focus-mode {
    /* 设置背景图片 */
    background-image: url('../assets/zhuanzhu.jpg') !important; 
    
    /* 确保图片覆盖全屏且固定，不随滚动条移动 */
    background-size: cover !important;
    background-position: center !important;
    background-attachment: fixed !important;
    background-repeat: no-repeat !important;
}

/* 专注模式下隐藏无关元素 */
body.focus-mode #section-shop,       /* 隐藏商店 */
body.focus-mode #side-inventory,     /* 隐藏侧边背包 (种植通过点击田地触发，不需要侧边栏) */
body.focus-mode .inventory-toggle-btn, /* 隐藏背包按钮 */
body.focus-mode #free-mode-controls, /* 隐藏自由模式按钮 */
body.focus-mode .section-title {     /* 隐藏标题 */
    display: none !important;
}

/* ==========================================================================
   4. 登录注册界面样式 (Auth Section)
   ========================================================================== */

.auth-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px 35px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 380px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.auth-card h2 {
    margin: 0 0 25px 0;
    color: #333;
    font-size: 1.6em;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-form input {
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1em;
    font-family: 'Nunito', sans-serif;
    transition: border-color 0.2s;
    outline: none;
}

.auth-form input:focus {
    border-color: #667eea;
}

.auth-error {
    color: #dc3545;
    font-size: 0.9em;
    min-height: 1.2em;
    margin: 0;
}

.auth-btn {
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: bold;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

.auth-btn:active {
    transform: translateY(2px);
}

.auth-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.auth-btn-primary:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.auth-btn-text {
    background: transparent;
    color: #667eea;
    font-weight: normal;
}

.auth-btn-text:hover {
    text-decoration: underline;
}

/* 仅在专注模式下显示控制条 */
body.focus-mode #focus-mode-controls {
    display: flex !important;
}

/* 隐藏原有的全宽背景图容器样式的影响，让 Body 背景生效 */
body.focus-mode .full-width-section {
    background: none !important;
    border: none !important;
    min-height: auto !important;
}
