/* 基本样式 */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --panel-bg-color: #ffffff;
    --border-color: #dee2e6;
    --text-color: #333;
    --highlight-color: #e9ecef;
    --sidebar-width: 450px;
    --sidebar-width-collapsed: 40px;
    --transition-speed: 0.3s;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ================== 主应用容器布局 ================== */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
    transition: margin-left var(--transition-speed);
}

/* ================== 侧边栏/控制面板 ================== */
.control-panel {
    width: var(--sidebar-width);
    background-color: var(--panel-bg-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: width var(--transition-speed), min-width var(--transition-speed);
    flex-shrink: 0;
    position: relative;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.sidebar-header h1 {
    margin: 0;
    font-size: 22px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    font-weight: 700;
}

.sidebar-header p {
    color: rgba(255,255,255,0.9) !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    font-weight: 500;
}

/* ================== 左侧模块标签页 ================== */
#left-panel-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 15px;
    background-color: #4a5568; /* 比头部深一点的背景 */
    border-bottom: 1px solid #2d3748;
}

.report-tab {
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.report-tab:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.report-tab.active {
    border-color: #fff;
    font-weight: bold;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* 特色标签样式（桩基施工台账） */
.report-tab.featured-tab {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    background-color: #DC3545 !important; /* 强制红色 */
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
    text-transform: none;
    letter-spacing: 0.5px;
}

.report-tab.featured-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(220, 53, 69, 0.4);
    background-color: #C82333 !important;
}

.report-tab.featured-tab.active {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.control-buttons {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-content {
    padding: 15px;
    flex-grow: 1;
}

/* ================== 文档区 ================== */
.document-area {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #e9ecef;
    display: flex;
    flex-direction: column;
}

/* 🎮 游戏指南全屏显示样式 */
.document-area.game-guide-fullscreen #document-content-left {
    width: 0 !important;
    min-width: 0 !important;
    flex: 0 !important;
    overflow: hidden;
    transition: all 0.3s ease;
}

.document-area.game-guide-fullscreen #right-panel {
    flex: 1 !important;
    transition: all 0.3s ease;
}

#document-content {
    flex-grow: 1;
    background-color: transparent; /* 修改：移除白色背景 */
    padding: 20px;
    box-shadow: none; /* 修改：移除阴影 */
    border-radius: 5px;
}

/* ================== 报告页面样式 ================== */
.report-page {
    background: white;
    width: 29.7cm;
    height: 20.5cm; /* A4 landscape height - padding */
    padding: 1cm;
    margin: 0 auto 20px auto;
    border: 1px solid #ccc;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    box-sizing: border-box;
    overflow: hidden;
}

.report-page h1, .report-page h2 {
    text-align: center;
    margin: 5px 0;
}
.report-page h1 { font-size: 18pt; }
.report-page h2 { font-size: 22pt; font-weight: bold; }

.report-header {
    display: flex;
    justify-content: space-between;
    font-size: 10pt;
    margin-bottom: 5px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
    table-layout: fixed;
}

.report-table th, .report-table td {
    border: 1px solid black;
    padding: 4px;
    text-align: center;
    height: 2.5em; /* 增加行高 */
}

.report-table th {
    background-color: #f2f2f2;
}

.report-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 10pt;
}

/* ================== 灌注时间选择器样式 ================== */
.pouring-time-selector {
    flex-direction: column;
    align-items: stretch;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
}

.pouring-time-selector > label {
    width: auto;
    text-align: left;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.time-range-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.time-point {
    display: flex;
    align-items: center;
    gap: 6px;
    background: white;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ced4da;
}

.time-point label {
    width: auto !important;
    margin-right: 6px !important;
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

.time-input {
    flex: none !important;
    width: auto !important;
    padding: 4px 6px !important;
    font-size: 13px !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 3px !important;
}

.time-separator {
    font-weight: 600;
    color: #495057;
    padding: 0 4px;
}

.apply-time-btn {
    background-color: #28a745 !important;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.apply-time-btn:hover {
    background-color: #218838 !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .time-range-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .time-point {
        justify-content: space-between;
    }

    .time-separator {
        text-align: center;
        padding: 4px 0;
    }
}

/* ================== UI组件样式 ================== */
.input-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    flex-basis: 100%; /* 默认占满一行 */
}

.control-buttons .input-group label {
    margin-right: 10px;
    font-weight: 500;
    width: 80px; /* 统一标签宽度 */
    text-align: right;
    flex-shrink: 0;
}

.input-group label {
    margin-right: 10px;
    font-weight: 500;
    width: 140px; /* 统一标签宽度 */
    text-align: right;
    flex-shrink: 0;
}

.input-group input[type="text"],
.input-group input[type="number"],
.input-group input[type="date"],
.input-group input[type="time"],
.input-group select {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1em;
}

.input-group button, button {
    padding: 8px 15px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 1em;
}

.input-group button:hover, button:hover {
    background-color: #0056b3;
}

.custom-select {
    flex-grow: 1;
}

.control-buttons .input-group {
    flex-basis: 100%; /* 默认占满一行 */
    align-items: stretch;
}

.control-buttons .button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.control-buttons .button-group button {
    width: 100%;
}

.highlight-input {
    background-color: #fffbe6;
    border-color: #ffeeba;
}

/* ================== 手风琴样式 ================== */
.accordion-container {
    padding: 0 15px;
}

.accordion-item {
    border-bottom: 1px solid var(--border-color);
}

.accordion-header {
    background: #f7f7f7;
    padding: 12px 15px;
    cursor: pointer;
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    transition: background-color 0.2s;
    position: relative;
}

.accordion-header:hover {
    background-color: #e9ecef;
}

.accordion-header::after {
    content: '▼';
    position: absolute;
    right: 15px;
    transition: transform 0.3s;
    font-size: 0.8em;
}

.accordion-item.is-open > .accordion-header::after {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding: 0 15px;
}

.accordion-item.is-open > .accordion-content {
    max-height: 2000px; /* 足够大的值 */
    padding: 15px;
}

.highlight-title {
    color: #856404;
    background-color: #fff3cd;
}

/* ================== 地质分层 ================== */
.geology-section .layer-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.geology-section .layer-input .layer-depth {
    width: 80px;
}

.geology-section .layer-input .geology-select {
    flex-grow: 1;
}

.remove-layer-btn {
    background-color: #dc3545;
    width: 30px;
    height: 30px;
    padding: 0;
    line-height: 30px;
    text-align: center;
}

/* ================== 侧边栏折叠逻辑 ================== */
#sidebar-toggle-btn {
    position: absolute;
    top: 15px;
    left: calc(var(--sidebar-width) - 40px); /* 定位到右上角 */
    z-index: 100;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    padding: 0;
    font-size: 1.2em;
    line-height: 30px;
    text-align: center;
    transition: left var(--transition-speed);
    background-color: #7112d0;
    border: 1px solid var(--border-color);
}

#sidebar-toggle-btn:hover {
    background-color: var(--highlight-color);
}

.app-container.sidebar-collapsed .control-panel {
    width: 0;
    min-width: 0;
    overflow: hidden;
}

.app-container.sidebar-collapsed #sidebar-toggle-btn {
    left: 5px; /* 收起时定位到左侧 */
    transform: scaleX(-1); /* 翻转箭头 */
}

/* ================== 旧版控件 ================== */
.legacy-controls {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background-color: #fdf8e4;
}
.legacy-controls h3 { margin-top: 0; }
.legacy-controls input { margin-right: 10px; margin-bottom: 10px; }

/* 响应式调整 */
@media (max-width: 768px) {
    .control-panel {
        position: absolute;
        width: 80%;
        height: 100%;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .app-container:not(.sidebar-collapsed) .control-panel {
        transform: translateX(0);
    }

    #sidebar-toggle-btn {
        left: 0;
    }
    
    .app-container:not(.sidebar-collapsed) #sidebar-toggle-btn {
        left: 80%;
    }
}

/* 生成数据的红色字体标记样式 */
.generated-data {
    color: #FF0000 !important;  /* WPS标准正红色 */
    font-weight: 500;
}

/* 打印时也保持红色 */
@media print {
    .generated-data {
        color: #FF0000 !important;  /* WPS标准正红色 */
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ================== 清孔模块样式 ================== */
.accordion-item-cleaning {
    border: 1px solid #17a2b8;
    border-radius: 6px;
    background: linear-gradient(135deg, #f8fdff 0%, #e6f9ff 100%);
}

.accordion-item-cleaning .accordion-header {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    border-radius: 5px 5px 0 0;
}

.cleaning-section {
    padding: 10px 0;
}

.cleaning-info-placeholder {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

.cleaning-info-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cleaning-item {
    background: #ffffff;
    border: 1px solid #e1f5fe;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(23, 162, 184, 0.1);
}

.cleaning-label {
    font-weight: 600;
    color: #17a2b8;
    font-size: 14px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e1f5fe;
    padding-bottom: 4px;
}

.cleaning-details {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.cleaning-time {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cleaning-date {
    background: #17a2b8;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    min-width: 45px;
    text-align: center;
}

.time-range {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    letter-spacing: 0.5px;
}

.duration {
    background: #e1f5fe;
    color: #0277bd;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

/* 清孔模块的响应式设计 */
@media (max-width: 768px) {
    .cleaning-time {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .cleaning-date,
    .time-range,
    .duration {
        font-size: 11px;
    }
}
