/* プラグインのスタイルの優先度を上げる */
body.page .entry-body #db-editor-container {
    max-width: 100% !important;
    overflow-x: visible !important;
}

body.page .entry-body #db-editor-container .table-container {
    width: 100% !important;
    overflow-x: auto !important;
    position: relative !important;
}

body.page .entry-body #db-editor-container table {
    width: 100% !important;
    white-space: nowrap !important;
}

#db-editor-container {
    max-width: 100%;
    font-size: 14px;
}

#date-range-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f8f8;
}

.date-inputs-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    align-items: center;
}

#date-range-form label {
    white-space: nowrap;
    font-size: 12px;
}

#date-range-form input[type="date"] {
    width: 130px;
    padding: 4px;
    font-size: 12px;
}

#date-range-form button {
    width: 100%;
    padding: 8px;
    margin-top: 4px;
    background-color: #45a049;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.button-container {
    margin: 10px 0;
    display: flex;
    gap: 10px;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    position: relative;
}

#db-editor-container table.db-editor-table {
    width: 100% !important;
    border-collapse: collapse !important;
    white-space: nowrap !important;
}

#db-editor-container table.db-editor-table th,
#db-editor-container table.db-editor-table td {
    border: 1px solid #ddd !important;
    padding: 2px 4px !important;
    text-align: left !important;
    vertical-align: middle !important;
}

#db-editor-container table.db-editor-table th {
    background-color: #f2f2f2 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
}

/* 列の幅を設定 */
#db-editor-container table.db-editor-table th:nth-child(1),
#db-editor-container table.db-editor-table td:nth-child(1) { 
    width: 40px !important; 
    min-width: 40px !important;
    max-width: 40px !important;
}  /* Delete列 */

#db-editor-container table.db-editor-table th:nth-child(2),
#db-editor-container table.db-editor-table td:nth-child(2) { 
    width: 70px !important; 
    min-width: 70px !important; 
    max-width: 70px !important;
}  /* Date No. */

#db-editor-container table.db-editor-table th:nth-child(3),
#db-editor-container table.db-editor-table td:nth-child(3),
#db-editor-container table.db-editor-table th:nth-child(4),
#db-editor-container table.db-editor-table td:nth-child(4) {
    width: 35px !important;
    min-width: 35px !important;
    max-width: 35px !important;
} /* H1, H2 */

#db-editor-container table.db-editor-table th:nth-child(5),
#db-editor-container table.db-editor-table td:nth-child(5) {
    width: 45px !important;
    min-width: 45px !important;
    max-width: 45px !important;
} /* Density */

#db-editor-container table.db-editor-table th:nth-child(6),
#db-editor-container table.db-editor-table td:nth-child(6) { 
    width: 85px !important;
    min-width: 85px !important;
    max-width: 85px !important;
} /* Rate */

#db-editor-container table.db-editor-table th:nth-child(7),
#db-editor-container table.db-editor-table td:nth-child(7) {
    width: 100px !important; 
    min-width: 100px !important; 
    } /* Cane Type */

#db-editor-container table.db-editor-table th:nth-child(8),
#db-editor-container table.db-editor-table td:nth-child(8) { 
    min-width: 240px !important;
    width: 240px !important;
} /* Notes */

#db-editor-container table.db-editor-table td:nth-child(2) {
    font-family: monospace !important;
    font-size: 12px !important;
    text-align: center !important;
    padding: 2px 0px !important;
}

#db-editor-container table.db-editor-table td:nth-child(3) input,
#db-editor-container table.db-editor-table td:nth-child(4) input {
    width: 100% !important;
    min-width: 30px !important;
    max-width: 35px !important;
    box-sizing: border-box !important;
    padding: 1px 2px !important;
    text-align: center !important;
    -moz-appearance: textfield !important;
}

#db-editor-container table.db-editor-table td:nth-child(5) input {
    width: 100% !important;
    min-width: 40px !important;
    max-width: 45px !important;
    box-sizing: border-box !important;
    padding: 2px !important;
    text-align: center !important;
    -moz-appearance: textfield !important;
}

/* 数値入力フィールドの矢印を非表示 */
#db-editor-container table.db-editor-table input[type="number"] {
    -moz-appearance: textfield !important;
}
#db-editor-container table.db-editor-table input[type="number"]::-webkit-inner-spin-button,
#db-editor-container table.db-editor-table input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

#db-editor-container table.db-editor-table input.editable {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 2px !important;
}

#db-editor-container table.db-editor-table select[name="rate"] {
    width: 100% !important;
    padding: 2px !important;
    border: 1px solid #ddd !important;
    border-radius: 3px !important;
    background-color: #fff !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    font-size: 14px !important;
}

.to-delete {
    text-decoration: line-through;
    opacity: 0.5;
}

#pagination-container {
    margin-top: 20px;
    text-align: center;
}

.pagination button {
    margin: 0 5px;
    padding: 5px 10px;
    background-color: #f2f2f2;
    border: 1px solid #ddd;
    cursor: pointer;
}

.pagination button.active {
    background-color: #4CAF50;
    color: white;
}

#save-changes, #back-button {
    padding: 10px 20px;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

#save-changes {
    background-color: #4CAF50;
    min-width: 150px;
}

#back-button {
    background-color: #f44336;
    min-width: 100px;
}

@media screen and (max-width: 600px) {
    #db-editor-container table.db-editor-table {
        font-size: 12px !important;
    }

    #db-editor-container table.db-editor-table th,
    #db-editor-container table.db-editor-table td {
        padding: 1px 2px !important;
    }

    #db-editor-container table.db-editor-table input.editable {
        padding: 1px !important;
    }

    #date-range-form input[type="date"] {
        width: 115px;
        font-size: 11px;
    }

    #date-range-form label {
        font-size: 11px;
    }

    #date-range-form button {
        font-size: 11px;
        padding: 6px;
        margin-top: 8px;
    }
}