/* ./style_components.css (已修改) */
/* 职责：定义可重用的UI组件，如模态框、通用按钮等。 */

/* --- 模态框基础样式 --- */
.modal { 
    position:fixed;
    inset:0; 
    align-items:center; 
    justify-content:center; 
    z-index:300; /* 基础模态框层级 */
    background-color: rgba(0,0,0,0.75);
}
.modal.hidden { 
    display: none !important; 
}
.modal:not(.hidden) { 
    display: flex;
}

#notification-modal, #confirm-modal {
    z-index: 400;
}

/* --- 通用按钮样式 --- */
.action-button-primary, .action-button-secondary { 
    padding: 0.75rem;
    text-align: center; 
    font-weight: bold; 
    border-radius: 0.375rem;
    font-size: 1rem; 
    transition: opacity 0.3s, filter 0.3s; 
    border: none;
    cursor: pointer;
}
.action-button-primary { 
    background-color: var(--color-purple);
    color: white;
}
.action-button-secondary { 
    background-color: var(--color-panel-light); 
    color: white;
}

.action-button-primary:disabled,
.action-button-secondary:disabled {
    filter: grayscale(70%);
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- 特定模态框样式 --- */

/* Data Modal (设置/帮助面板) */
#data-modal .modal-content { 
    background-color: var(--color-panel);
    padding:1.5rem; 
    border-radius: 0.5rem;
    max-width: 42rem; 
    width:90%;
    display: flex;
    flex-direction: column;
    height: 85vh;
}

/* Web 1600×900 画布：vh/vw 相对手机视口会把弹窗缩成一小块，改用相对画布的 % */
body.platform-web .modal {
    position: absolute;
}
body.platform-web #data-modal .modal-content {
    height: 85%;
    max-height: 85%;
    width: 90%;
}
body.platform-web #player-hub-modal .modal-content-full {
    width: 85%;
    height: 85%;
    max-width: 1400px;
}
body.platform-web #notification-modal .modal-content,
body.platform-web #confirm-modal .modal-content,
body.platform-web #game-over-modal .modal-content,
body.platform-web #demo-end-modal .modal-content,
body.platform-web #interaction-modal .modal-content {
    /* max-w-sm 等仍是 rem，相对 16px 设计稿；宽度用画布百分比兜底 */
    width: min(90%, 28rem);
}
#data-modal .modal-tabs { 
    display: flex;
    border-bottom: 2px solid var(--color-panel-light);
    margin-bottom: 1rem; 
    flex-shrink: 0;
}
#data-modal .modal-tab { 
    padding: 0.5rem 1rem; 
    cursor: pointer;
    color: var(--color-text-dim);
}
#data-modal .modal-tab.active { 
    color: white; 
    border-bottom: 2px solid var(--color-purple);
}
#data-modal .modal-tab-content { 
    display: none; 
    padding-top: 1rem; 
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 1rem;
}
#data-modal .modal-tab-content.active { 
    display: block;
}

#data-modal #settings-log-container {
    min-height: 12rem;
}

#data-modal #settings-log-container .log-message {
    margin-bottom: 0.25rem;
}

#data-modal .modal-actions-grid { 
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem; 
    margin-top: 1.5rem;
    flex-shrink: 0;
}

/* 设置页：标签优先不换行，控件别撑满整行 */
#data-modal .settings-field-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
#data-modal .settings-field-label {
    flex: 0 0 auto;
    white-space: nowrap;
    min-width: 5.5em;
}
#data-modal .settings-field-control {
    flex: 1 1 16rem;
    max-width: 22rem;
    width: 100%;
}
#data-modal .settings-field-slider {
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
    min-width: 8rem;
}
#data-modal .settings-field-value {
    flex: 0 0 3.25rem;
    text-align: right;
    white-space: nowrap;
}

#data-modal #close-data-modal-button {
    grid-column: 2 / 3;
}

/* Game Over & Notification Modals */
#game-over-modal .modal-content,
#notification-modal .modal-content,
#confirm-modal .modal-content,
#interaction-modal.bestiary-portrait-overlay {
    z-index: 450;
}

#interaction-modal .modal-content {
    background-color: var(--color-panel);
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    text-align: center;
    max-width: 24rem;
    width: 90%;
}

/* --- 【新增】为通知模态框添加富文本样式 --- */
#notification-unlock-layout #notification-title {
    font-size: 1.125rem; /* 18px */
    color: #9CA3AF; /* gray-400 */
}
#notification-unlock-layout #notification-feature-name {
    font-size: 1.875rem; /* 30px */
    font-weight: 700;
    color: var(--color-purple); /* purple-500 */
    margin: 0.5rem 0;
}
#notification-unlock-layout #notification-description {
    font-size: 0.875rem; /* 14px */
    color: #D1D5DB; /* gray-300 */
    margin-bottom: 1.5rem;
    line-height: 1.6;
}
/* ------------------------------------- */

/* --- 【修复-童心】为浮动文字添加换行属性 --- */
.floating-text {
    /* ... existing styles ... */
    white-space: pre-line;
    /* 允许通过 \n 换行 */
}


/* --- Toggle Switch 组件样式 --- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #6b7280;
    transition: .4s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--color-purple);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--color-purple);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* 装备槽位标记（武器：主手 / 特化） */
.item-equip-slot-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: bold;
    padding: 0.12rem 0.45rem;
    border-radius: 0.25rem;
    vertical-align: middle;
    margin-left: 0.35rem;
    line-height: 1.35;
    white-space: nowrap;
}

.item-slot-badge-main {
    color: #7dd3fc;
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(125, 211, 252, 0.45);
}

.item-slot-badge-special {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.4);
}