body {
    font-family: sans-serif;
    line-height: 1.6;
    margin: 20px;
}

h1, h2 {
    color: #333;
}

/* Remove bottom margin from individual areas as they are now in columns */
.input-area, .video-area, .controls, .subtitle-area {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 15px; /* Keep some margin between items in the same column */
}

/* Ensure last item in each column doesn't have bottom margin */
.left-column > div:last-child,
.right-column > div:last-child {
    margin-bottom: 0;
}

/* Main container for two-column layout */
.main-container {
    display: flex;
    gap: 20px; /* Space between columns */
}

/* Left column styling */
.left-column {
    flex: 0 0 70%; /* Takes up 70% width, doesn't grow or shrink */
    display: flex;
    flex-direction: column;
}

/* Right column styling */
.right-column {
    flex: 0 0 calc(30% - 20px); /* Takes up 30% width minus the gap, doesn't grow or shrink */
    display: flex; /* Make it a flex container to manage its child */
    flex-direction: column;
}

/* Make subtitle area fill the right column */
.subtitle-area {
    flex-grow: 1; /* Allow subtitle area to grow */
    display: flex;
    flex-direction: column; /* Stack title, list, button vertically */
    min-height: 0; /* Necessary for flex children overflow */
}

.input-area input[type="text"] {
    width: 70%;
    padding: 8px;
    margin-right: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.input-area button {
    padding: 8px 15px;
    background-color: #5cb85c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.input-area button:hover {
    background-color: #4cae4c;
}

.video-area #player {
    width: 100%;
    height: 400px; /* 可根據需要調整 */
}

.controls ul {
    list-style: none;
    padding: 0;
}

.controls li {
    margin-bottom: 5px;
}

.subtitle-area ul {
    list-style: none;
    padding: 0;
    /* Make the list scrollable */
    max-height: 400px; /* Match video height initially, adjust as needed */
    overflow-y: auto; /* Enable vertical scrolling */
    flex-grow: 1; /* Allow list to take available space */
    min-height: 0; /* Necessary for flex children overflow */
    border: 1px solid #eee; /* Add a border around the scrollable list */
    border-radius: 4px;
    margin-top: 10px; /* Space between title and list */
    margin-bottom: 10px; /* Space between list and button */
}

.subtitle-area li {
    background-color: #f9f9f9;
    margin-bottom: 8px; /* Increase margin slightly */
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 10px 12px; /* Adjust padding */
    display: flex; /* Use flexbox for main layout */
    align-items: flex-start; /* Align items to the top */
    gap: 8px; /* Add gap between number, content, and button */
}

/* Remove specific span cursor rule, handled by input click now */
/* .subtitle-area li span {
     cursor: pointer;
} */

.subtitle-area li:hover {
    background-color: #eee; /* Add hover effect */
}

.subtitle-area button {
    padding: 10px 20px;
    background-color: #0275d8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.subtitle-area button:hover {
    background-color: #025aa5;
}
/* Style for the currently active subtitle item */
.subtitle-area li.active {
    background-color: #dff0d8; /* Light green background */
    border-color: #c3e6cb;
    font-weight: bold;
}
/* Style for the delete button */
.delete-btn {
    background: none;
    border: none;
    color: #dc3545; /* Red color */
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px; /* Minimal padding */
    line-height: 1; /* Ensure tight fit */
    margin-left: 10px; /* Space between text and button */
}

.delete-btn:hover {
    color: #a71d2a; /* Darker red on hover */
}
/* --- Styles for Editable Subtitle Items --- */

.subtitle-area li > *:nth-child(1) { /* Style for the number */
    flex-shrink: 0; /* Prevent number from shrinking */
    padding-top: 5px; /* Align number better with first line of text */
    font-weight: bold;
}

.subtitle-area li > *:nth-child(2) { /* Style for the time/text container */
    flex-grow: 1; /* Allow content to take available space */
    display: flex;
    flex-direction: column;
    gap: 5px; /* Space between time row and text area */
}

.time-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.time-input {
    font-family: monospace; /* Use monospace font for time */
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    width: 110px; /* Fixed width for time inputs */
    text-align: center;
    font-size: 0.9em;
    cursor: pointer; /* Indicate clickable for seeking */
}

.time-input:disabled {
    background-color: #eee;
    cursor: not-allowed;
}

.time-arrow {
    font-weight: bold;
}

.subtitle-text-input {
    width: 100%; /* Take full width of its container */
    height: 7em;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-family: inherit; /* Use body font */
    font-size: 0.95em;
    resize: vertical; /* Allow vertical resize */
    box-sizing: border-box; /* Include padding/border in width */
}

.delete-btn {
    align-self: flex-start; /* Align button to the top */
    margin-left: 0; /* Remove previous margin */
    flex-shrink: 0; /* Prevent button from shrinking */
}

/* Style for the file input area */
.file-input-area {
    margin-bottom: 10px; /* Space below file input */
    padding: 10px;
    background-color: #f0f0f0;
    border: 1px dashed #ccc;
    border-radius: 4px;
}

.file-input-area label {
    margin-right: 10px;
    font-weight: bold;
}

.file-input-area input[type="file"] {
    font-size: 0.9em;
}

/* === YT-SRT Page Styles === */
.yt-srt-container {
    /* max-width: 800px; */ /* 改為全寬 */
    width: 100%;
    margin: 0; /* 移除 auto margin */
    padding: 20px;
    background-color: #f0f8ff; /* AliceBlue for a light, clean look */
    /* border-radius: 8px; */ /* 全寬時通常不需要圓角 */
    /* box-shadow: 0 4px 12px rgba(0,0,0,0.1); */ /* 全寬時陰影效果可能不理想 */
    box-sizing: border-box; /* 確保 padding 不會超過 viewport */
}

/* Ensure h1 within body but outside yt-srt-container is also styled if it exists */
body > h1 {
    text-align: center;
    color: #333;
    margin-top: 20px;
    margin-bottom: 20px; /* Consistent margin */
}

.yt-srt-container h1 { /* For h1 inside the container, if any */
    text-align: center;
    color: #2c3e50; /* Darker blue */
    margin-bottom: 25px;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 18px; /* Slightly more gap */
    margin-bottom: 25px;
    padding: 20px;
    border: 1px solid #b0c4de; /* LightSteelBlue border */
    border-radius: 6px;
    background-color: #ffffff;
}

.input-section div {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-section label {
    font-weight: bold;
    font-size: 0.95em;
    color: #34495e; /* Wet Asphalt */
}

.input-section input[type="text"],
.input-section input[type="file"] {
    padding: 10px 12px;
    border: 1px solid #ced4da; /* Lighter gray border */
    border-radius: 4px;
    font-size: 1em;
    width: 100%;
    box-sizing: border-box;
}

.input-section button {
    padding: 12px 20px;
    background-color: #3498db; /* Peter River blue */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.05em;
    transition: background-color 0.2s ease-in-out;
}

.input-section button:hover {
    background-color: #2980b9; /* Belize Hole blue */
}

.sharable-link-section {
    margin-top: 10px; /* 與上方按鈕的間距 */
    display: flex;
    align-items: center; /* 垂直置中按鈕和訊息 */
}


.video-section {
    position: relative;
    width: 100%;
    /* max-width: 720px; */ /* 改為全寬 */
    /* margin: 0 auto; */ /* 改為全寬 */
    background-color: #000;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#player {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
    display: block; /* Ensure it behaves as a block element */
}

/* Ensure the iframe itself fills the #player container */
#player iframe {
    width: 100% !important; /* 強制闊度 */
    height: 100% !important; /* 強制高度 */
    border: 0; /* 順便移除 iframe 預設邊框 */
}

#subtitle-display {
    background-color: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 12px 18px;
    text-align: center;
    font-size: clamp(1.15em, 2.5vw, 2.2em);
    line-height: 1.5;
    min-height: 2.5em; /* Enough for about two lines, adjust as needed */
    box-sizing: border-box;
    width: 100%;
    font-family: Calibri, 'Heiti TC', 'Heiti SC', '源石黑體', tauhu-oo, sans-serif; /* Clear font for subtitles */
    /* If you want subtitles overlayed:
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    border-radius: 4px;
    */
}

/* General body styling if not already set */
body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    background-color: #e9ecef; /* Light grey page background */
    color: #212529; /* Default text color */
}

/* Style for the subtitle preview bar in SRT-maker */
#subtitle-preview-display {
    background-color: rgba(0, 0, 0, 0.75); /* 跟 YTSRT 一樣的背景 */
    color: #fff;
    padding: 10px 15px; /* 稍微調整 padding */
    text-align: center;
    font-size: 1.1em; /* 稍微調整字體大小 */
    line-height: 1.4;
    min-height: 2.4em; /* 大約兩行的高度 */
    box-sizing: border-box;
    width: 100%;
    margin-top: 0; /* 緊貼播放器下方 */
    border-bottom-left-radius: 5px; /* 配合 video-area 的圓角 */
    border-bottom-right-radius: 5px;
    font-family: Calibri, 'Heiti TC', 'Heiti SC', '源石黑體', tauhu-oo, sans-serif; /* 使用易讀字體 */
}