html {
  box-sizing: border-box;
  height: 100%;
  overflow: hidden;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body {
    margin: 0;
    padding: 0; /* Ensure no default padding */
    height: 100%; /* Body takes full height of html */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f9;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center .container horizontally */
    overflow: hidden; /* Body itself should not scroll */
}

.container {
    width: 100%;
    max-width: 760px;
    /* height: 100vh; */ /* Removed, will use flex-grow */
    flex-grow: 1; /* Container takes all available vertical space in body */
    margin: 0; /* Horizontal centering is by body's align-items, vertical by flex-grow */
    background-color: #fff;
    padding: 20px;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    /* box-sizing: border-box; */ /* Inherited */
    overflow: hidden; /* Container itself should not scroll */
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-top: 0; /* Adjust margin since container has padding */
    margin-bottom: 20px;
    font-size: 2em;
    flex-shrink: 0; /* Prevent shrinking */
}

.input-section {
    margin-bottom: 15px;
    flex-shrink: 0; /* Prevent shrinking */
}

.input-section textarea {
    width: calc(100% - 22px); /* Account for padding and border */
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px; /* Slightly smaller font for textarea */
    min-height: 80px; /* Reduced min-height */
    resize: vertical;
}

button {
    padding: 10px 18px;
    margin: 8px 5px;
    border: 1px solid transparent;
    border-radius: 8px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button:hover {
    background-color: #0056b3;
    border-color: #004085;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}




#processInputBtn {
    background-color: #3498db;
    color: white;
    display: block;
    width: 100%;
    margin-bottom: 15px; /* Reduced margin */
    padding: 10px 15px; /* Ensure padding is consistent */
}

#processInputBtn:hover {
    background-color: #2980b9;
}

.controls-section {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0; /* Prevent shrinking */
}

.controls-section button {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

.controls-section button:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

#deleteSelectedBtn {
    background-color: #e74c3c;
}

#deleteSelectedBtn:hover {
    background-color: #c0392b;
    border-color: #a93226;
}

.output-section {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allow output section to grow */
    overflow: hidden; /* Prevent output-section itself from scrolling */
    /* min-height: 0; */ /* Helpful for flex children in some cases, might not be needed here */
}

.output-section h2 {
    color: #34495e;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-top: 0; /* Adjust margin */
    margin-bottom: 15px;
    flex-shrink: 0; /* Prevent shrinking */
}

#recordList {
    list-style-type: none;
    padding: 10px;
    margin-top: 0; /* Adjusted margin to follow h2's margin-bottom */
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 100px; /* Keep a minimum height */
}

/* .expanded class might still be used by JS to toggle input section, but its effect on #recordList height is now managed by flex-grow */
#recordList.expanded {
    /* If input section is hidden, flex-grow will naturally allow #recordList to take more space */
    /* No specific max-height needed here anymore if parent container and flex properties are set correctly */
}

.record-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.record-item:last-child {
    border-bottom: none;
}

.record-item.viewed .record-text {
    text-decoration: line-through;
    color: #95a5a6;
}

.record-checkbox {
    margin-right: 10px;
    transform: scale(1.2); /* Make checkbox slightly larger */
}

.record-text {
    flex-grow: 1;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.record-text[contenteditable="true"]:focus {
    background-color: #e8f0fe;
    outline: 1px solid #3498db;
}

.record-item button {
    margin-left: 8px;
    padding: 6px 10px;
    font-size: 14px;
}

.copy-btn {
    background-color: #2ecc71;
    color: white;
}

.copy-btn:hover {
    background-color: #27ae60;
}

.view-status-btn {
    background-color: #9b59b6;
    color: white;
}

.view-status-btn:hover {
    background-color: #8e44ad;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    body {
        /* padding: 10px; Body padding removed for full screen layout */
        font-size: 14px; 
    }
    .container {
        padding: 10px; /* Adjust container padding for mobile */
        border-radius: 0; /* Ensure no radius on mobile if edge-to-edge */
    }

    .container {
        padding: 15px 10px; /* Adjust container padding */
    }

    h1 {
        font-size: 1.8em; /* Adjust heading size */
    }

    .input-section textarea {
        font-size: 15px; /* Ensure textarea font is readable */
        min-height: 80px;
    }

    button,
    .controls-section button,
    .record-item button {
        font-size: 14px; /* Adjust button font size */
        padding: 8px 12px; /* Adjust button padding */
    }

    #processInputBtn {
        padding: 12px 15px; /* Make main action button a bit larger */
    }

    .controls-section {
        flex-direction: column;
        gap: 8px; /* Adjust gap for stacked buttons */
    }

    .controls-section button {
        width: 100%;
        margin-bottom: 0; /* Remove bottom margin as gap is used */
    }

    .output-section h2 {
        font-size: 1.2em;
    }

    #recordList {
        padding: 8px;
        /* max-height: 250px; */ /* Removed to allow flex-grow to manage height */
    }

    .record-item {
        flex-wrap: wrap; 
        padding: 10px 0;
    }

    .record-checkbox {
        transform: scale(1.1); /* Slightly smaller checkbox */
        margin-right: 8px;
    }

    .record-item .record-text {
        width: 100%; 
        margin-bottom: 8px; 
        padding: 8px 5px;
    }

    .record-item .copy-btn,
    .record-item .view-status-btn {
        width: calc(50% - 4px); /* Make buttons take half width with a small gap */
        margin: 5px 0 0 0;
    }

    .record-item .copy-btn {
        margin-right: 4px; /* Gap between the two buttons */
    }
    .record-item .view-status-btn {
        margin-left: 4px; /* Gap between the two buttons */
    }
}