* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f0f0;
    font-size: 14px;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Menu Bar */
.menu-bar {
    display: flex;
    background-color: #f5f5f5;
    border-bottom: 1px solid #ccc;
    padding: 0 5px;
}

.menu-item {
    position: relative;
}

.menu-title {
    display: inline-block;
    padding: 8px 15px;
    cursor: pointer;
}

.menu-title:hover {
    background-color: #e0e0e0;
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    border: 1px solid #ccc;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    min-width: 150px;
    z-index: 1000;
}

.menu-item:hover .menu-dropdown {
    display: block;
}

.menu-dropdown button {
    display: block;
    width: 100%;
    padding: 8px 15px;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
}

.menu-dropdown button:hover {
    background-color: #e0e0e0;
}

.menu-dropdown hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 3px 0;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 5px;
    padding: 5px 10px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #ccc;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 15px;
    border: 1px solid #ccc;
    background-color: #fff;
    cursor: pointer;
    border-radius: 3px;
}

.toolbar-btn:hover {
    background-color: #e8e8e8;
}

.toolbar-btn .icon {
    font-size: 16px;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 10px;
    overflow: auto;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 10px;
}

.tab-btn {
    padding: 8px 20px;
    border: 1px solid #ccc;
    border-bottom: none;
    background-color: #e0e0e0;
    cursor: pointer;
    border-radius: 5px 5px 0 0;
}

.tab-btn.active {
    background-color: #fff;
    border-bottom: 1px solid #fff;
    margin-bottom: -1px;
}

.tab-content {
    background-color: #fff;
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 0 5px 5px 5px;
}

.tab-content.hidden {
    display: none;
}

/* Section */
.section {
    margin-bottom: 20px;
}

.section h3 {
    margin-bottom: 10px;
    color: #333;
}

/* Material Table */
.material-table {
    border-collapse: collapse;
    margin-bottom: 15px;
}

.material-table th,
.material-table td {
    border: 1px solid #ccc;
    padding: 5px 10px;
    text-align: center;
    background-color: #f9f9f9;
}

.material-table th {
    background-color: #e8e8e8;
    font-weight: normal;
}

.material-table input {
    width: 80px;
    padding: 3px;
    text-align: right;
    border: 1px solid #ccc;
}

/* Design method selector */
#designMethod {
    padding: 5px 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 3px;
    min-width: 320px;
}

/* Method-dependent material columns (toggled from app.js) */
.material-table.method-lsd .col-usd,
.material-table.method-usd .col-lsd {
    display: none;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

/* Data Table */
.table-container {
    overflow-x: auto;
    max-width: 100%;
}

.data-table {
    border-collapse: collapse;
    font-size: 12px;
    white-space: nowrap;
}

.data-table th,
.data-table td {
    border: 1px solid #ccc;
    padding: 4px 8px;
    text-align: center;
}

.data-table th {
    background-color: #f5f5f5;
    font-weight: normal;
    position: sticky;
    top: 0;
}

.data-table td input {
    width: 100%;
    min-width: 60px;
    padding: 3px;
    border: 1px solid #ddd;
    text-align: right;
}

.data-table td input:focus {
    outline: 2px solid #4a90d9;
    border-color: #4a90d9;
}

.data-table td select {
    width: 100%;
    padding: 3px;
    text-align: center;
}

.col-name { min-width: 150px; }
.col-force { min-width: 70px; }
.col-sec { min-width: 60px; }
.col-band { min-width: 70px; }
.col-shear { min-width: 70px; }
.col-result { min-width: 80px; background-color: #f9f9f9; }

.data-table td.result-cell {
    background-color: #f0f8ff;
    font-weight: bold;
}

.data-table td.result-ok {
    background-color: #e6ffe6;
    color: #006600;
}

.data-table td.result-ng {
    background-color: #ffe6e6;
    color: #cc0000;
}

/* Column visibility */
.col-force.hidden,
.col-sec.hidden,
.col-band.hidden,
.col-shear.hidden {
    display: none;
}

/* Status Bar */
.status-bar {
    padding: 5px 10px;
    background-color: #f5f5f5;
    border-top: 1px solid #ccc;
    font-size: 12px;
    color: #666;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-large {
    width: 900px;
    height: 80vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: normal;
}

.close-btn {
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
}

.close-btn:hover {
    color: #000;
}

.modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    justify-content: flex-start;
}

.modal-footer button {
    padding: 8px 20px;
    border: 1px solid #ccc;
    background-color: #f5f5f5;
    cursor: pointer;
    border-radius: 3px;
}

.modal-footer button:hover {
    background-color: #e0e0e0;
}

/* Calculation Tabs */
.calc-tabs {
    display: flex;
    gap: 2px;
    padding: 10px 20px 0;
}

.calc-tab-btn {
    padding: 8px 20px;
    border: 1px solid #ccc;
    border-bottom: none;
    background-color: #e0e0e0;
    cursor: pointer;
    border-radius: 5px 5px 0 0;
}

.calc-tab-btn.active {
    background-color: #fff;
}

.calc-content {
    flex: 1;
    overflow: auto;
    padding: 0 20px 20px;
    border-top: 1px solid #ccc;
    margin: 0 20px;
    background-color: #fff;
}

.calc-text {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    padding: 15px;
    background-color: #fafafa;
    border: 1px solid #eee;
    margin-top: 10px;
}

.calc-text.hidden {
    display: none;
}

/* jspreadsheet customization */
#spreadsheet {
    margin-top: 10px;
}

.jexcel_content {
    font-size: 12px;
}

.jexcel thead td {
    background-color: #f5f5f5 !important;
    font-weight: normal;
    white-space: pre-line;
    vertical-align: middle;
    text-align: center;
}

.jexcel tbody td {
    text-align: right;
    padding: 4px 6px;
}

.jexcel tbody td:first-child {
    text-align: left;
}

/* Row numbers */
.jexcel > tbody > tr > td:first-child {
    background-color: #f5f5f5;
    text-align: center;
}

/* Responsive */
@media (max-width: 1200px) {
    .modal-large {
        width: 95%;
    }
}
