/* General Body and Typography */
body {
    font-family: sans-serif;
    padding: 20px;
    background-color: #f4f4f9;
    color: #333;
}

h1 {
    font-family: 'Zen Dots', sans-serif;
    font-size: 40px;
    color: #4a4a4a;
    border-bottom: 2px solid #ccc;
    padding-bottom: 10px;
    letter-spacing: 2px;
}

p {
    margin-bottom: 20px;
}

/* Form Elements */
div {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

/* Specific label styling inside a div, e.g., for text inputs */
div > label {
    margin-top: 15px;
}

/* Hide the actual file input */
input[type="file"] {
    display: none;
}

input[type="text"] {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    margin-bottom: 10px;
}

/* Common styles for buttons and labels acting as buttons */
button,
.file-label-button {
  display: inline-block;
  width: 220px;
  text-align: center;
  box-sizing: border-box;
  padding: 8px 15px;
  cursor: pointer;
  border: 3px solid #000;
  border-radius: 0;
  background: #fff;
  color: #333;
  font-size: 13px;
  font-weight: bold;
  margin: 0 5px 10px 5px;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
}

button:hover,
.file-label-button:hover {
  color: #fff;
  background: #000;
  transform: translateY(-2px);
}

.file-label-button + span {
    margin-left: 15px;
    font-style: italic;
    color: #555;
    vertical-align: middle;
}

/* Drag and Drop List Styles */
#pageListContainer,
#fileListContainer {
    margin-top: 20px;
    border: 1px dashed #ccc;
    padding: 10px;
    border-radius: 5px;
    min-height: 100px;
}

#fileListContainer.dragover {
    background-color: #e8f0fe;
    border-color: #4285f4;
}

#pageList li,
#fileList li {
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    margin-bottom: 5px;
    cursor: grab;
}

#pageList li.dragging,
#fileList li.dragging {
    opacity: 0.5;
    background: #cde;
}

/* Log Area */
#log {
    border: 1px solid #ccc;
    background-color: #fff;
    padding: 15px;
    margin-top: 20px;
    min-height: 50px;
    border-radius: 5px;
    overflow-y: auto;
}

#log a {
    display: block;
    margin: 5px 0;
    color: #007bff;
    text-decoration: none;
}

#log a:hover {
    text-decoration: underline;
}

/* Menu Page Specific Styles */
.container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    background-color: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    text-align: center;
}

.button-group {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}


/* Footer Styles */
footer {
    text-align: center;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    color: #777;
    font-size: 0.9em;
}

/* Hamburger Menu */
.hamburger-menu {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 1001; /* Overlayよりも手前に */
}

.hamburger-menu span {
    display: block;
    position: absolute;
    width: 100%;
    height: 3px;
    background-color: #333;
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
}

.hamburger-menu span:nth-child(1) { top: 0; }
.hamburger-menu span:nth-child(2) { top: 9px; }
.hamburger-menu span:nth-child(3) { top: 18px; }

/* Nav Menu */
.nav-menu {
    position: fixed;
    top: 0;
    right: -300px; /* Start off-screen */
    width: 250px;
    height: 100%;
    background-color: #fff;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    padding: 60px 20px 20px;
    transition: right 0.3s ease-in-out;
    z-index: 1000;
}

.nav-menu.open {
    right: 0; /* Slide in */
}

.nav-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-menu li {
    margin-bottom: 20px;
}

.nav-menu a {
    text-decoration: none;
    color: #333;
    font-size: 18px;
    font-weight: bold;
}

.nav-menu a:hover {
    color: #007bff;
}

/* Overlay for when menu is open */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    z-index: 999;
}

.overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Hamburger animation to "X" */
.hamburger-menu.open span:nth-child(1) {
    top: 9px;
    transform: rotate(45deg);
}

.hamburger-menu.open span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.open span:nth-child(3) {
    top: 9px;
    transform: rotate(-45deg);
}

/* =================================================================
   Responsive Styles for smaller screens
   ================================================================= */
@media (max-width: 768px) {
    body {
        padding: 10px;
        -webkit-text-size-adjust: 100%; /* iOSでの文字サイズ自動調整を防ぐ */
    }

    .container {
        margin: 20px auto;
        padding: 15px;
        width: auto; /* 幅を自動調整 */
    }

    h1 {
        font-size: 24px;
        letter-spacing: normal; /* スマホでは字間を詰める */
        word-break: break-word;
    }

    /* ボタンとファイル選択ラベルを画面幅に合わせる */
    button,
    .file-label-button {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 12px 15px; /* タップしやすくする */
    }

    /* ファイル選択エリアのレイアウトを縦並びに (pdf_jpg.html) */
    .file-select-container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    /* ファイル名表示部分のスタイル調整 */
    #fileNameLabel,
    #pdfFileName,
    #jpgFileName {
        display: block;
        text-align: center;
        word-break: break-all;
        margin-left: 0;
        margin-top: 8px;
    }

    /* pdf_jpg.htmlではflexのgapで調整するので不要 */
    .file-select-container span {
        margin-top: 0;
    }

    /* join_pdf.html などで <br> がある場合の調整 */
    .file-label-button + br + #fileNameLabel {
        margin-top: 4px;
    }
}
