@charset "utf-8";

body {
    font-family: Arial, sans-serif;
    margin: 20px;
    background-color: khaki;
}

h1 {
    text-align: center;
}
h2 {
    text-align: center;
    margin-bottom: 0px;
}

p {
    margin-top: 3px;
    margin-bottom: 3px;
    text-align: center;
}

.small {
    text-align: center;
    font-size: 12px;
}

.container {
    max-width: 1200px;
    min-width: 375px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tabs {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    border: none;
    background: #f0f0f0;
    margin-right: 4px;
    border-radius: 8px 8px 0 0;
    font-weight: bold;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.tab.active {
    background: #007bff;
    color: white;
}

.tab:hover:not(.active) {
    background: #e0e0e0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.month-filter {
    width: fit-content;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin: 20px auto;
}

.month-filter label {
    margin-right: 10px;
    font-weight: bold;
}

.period-filter {
    margin-left: 10px;
    padding-left: 10px;
}

/* テーブルコンテナ - 横スクロール対応 */
.table-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 20px auto;
    overflow: hidden;
    
    /* 固定幅を保持し、必要に応じて横スクロール */
    width: 480px;
    max-width: 90%;
    overflow-x: auto;
}

/* テーブル基本スタイル */
.product-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0 auto;
    /* 最小幅を設定してテーブルが縮みすぎないようにする */
    min-width: 375px;
}

/* ヘッダー固定 - 修正版 */
.product-table thead {
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.product-table th {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    background-color: #f8f9fa;
    font-weight: bold;
    border-bottom: 2px solid #ddd;
    position: sticky;
    top: 0;
    font-size: 14px;
}

.product-table td {
    border: 1px solid #ddd;
    padding: 4px;
    text-align: left;
    font-size: 12px;
    height:40px;
}

/* スクロール可能なボディ部分 - 修正版 */
.table-wrapper {
    max-height: 380px;
    overflow-y: auto;
    overflow-x: auto;
    margin: 0 auto;
}

.scrollable-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    /* 最小幅を設定 */
    min-width: 380px;
}

.scrollable-table tbody {
    display: table-row-group;
}

.scrollable-table tr {
    display: table-row;
}

/* 通常表示（8行未満の場合） */
.normal-table tbody tr {
    display: table-row;
}

/* 列幅の調整 - px単位で指定 */
.product-table th:nth-child(1),
.product-table td:nth-child(1),
.scrollable-table th:nth-child(1),
.scrollable-table td:nth-child(1) {
    width: 95px;
    min-width: 95px;
}

.product-table th:nth-child(2),
.product-table td:nth-child(2),
.scrollable-table th:nth-child(2),
.scrollable-table td:nth-child(2) {
    width: 65px;
    min-width: 65px;
}

.product-table th:nth-child(3),
.product-table td:nth-child(3),
.scrollable-table th:nth-child(3),
.scrollable-table td:nth-child(3) {
    width: 65px;
    min-width: 65px;
}

.product-table th:nth-child(4),
.product-table td:nth-child(4),
.scrollable-table th:nth-child(4),
.scrollable-table td:nth-child(4) {
    width: 65px;
    min-width: 65px;
}

.product-table th:nth-child(5),
.product-table td:nth-child(5),
.scrollable-table th:nth-child(5),
.scrollable-table td:nth-child(5) {
    width: 70px;
    min-width: 70px;
}


.quantity-input {
    width: 50px;
    padding: 4px;
    text-align: right;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.price-input {
    width: 80px;
    padding: 4px;
    text-align: right;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.total-price {
    font-weight: bold;
    color: #007bff;
}

.global-controls {/**/
    width: fit-content;
    margin: 25px auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    text-align: center;
}

.time-sale {
    margin-bottom: 10px;
}

.time-sale label {
    font-size: 16px;
    font-weight: bold;
    color: #dc3545;
}

.price-increase {
    margin-bottom: 10px;
}

.price-increase label {
    font-size: 16px;
    font-weight: bold;
    color: cornflowerblue;
}

.grand-total {
    font-size: 24px;
    font-weight: bold;
    color: #28a745;
    /*margin: 5px 0;*/
}

.reset-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.double-price-checkbox {
    margin-left: 10px;
}

.link-container {
  white-space: nowrap; /* 改行させない */
  text-align: center;      /* 中央揃え */
}

.link-container a {
  display: inline-block;
  margin-right: 15px;
}

/* 最後のリンクの右の余白を消す場合（任意） */
.link-container a:last-child {
  margin-right: 0;
}