body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 40px 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    box-sizing: border-box;
    overflow-y: scroll; /* 始终显示滚动条，防止页面跳动 */
}

.app-container {
    width: 100%;
    max-width: 1200px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    padding: 24px 32px;
    box-sizing: border-box;
}

.header-image {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 0 auto 20px;
    border-radius: 8px;
}

h1 {
    text-align: center;
    color: #1c1e21;
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 24px;
}
.main-content {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 24px;
   align-items: flex-start;
}
.card {
   background-color: #ffffff;
   border: 1px solid #e0e0e0;
   border-radius: 8px;
   padding: 20px;
   display: flex;
   flex-direction: column;
   height: 100%;
   box-sizing: border-box;
}
.input-group {
    margin-bottom: 16px;
}
.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}
.input-group input[type="text"],
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.input-group textarea {
    min-height: 150px;
    resize: vertical;
}
.readonly-textarea {
    background-color: #f5f6f7;
    color: #333;
    cursor: not-allowed;
}
button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    background-color: #1877f2;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
button:disabled {
    background-color: #a0bdf0;
    cursor: not-allowed;
}
button:hover:not(:disabled) {
    background-color: #166fe5;
}
.loader {
   display: none;
   text-align: center;
   padding: 10px 0;
   font-style: italic;
   color: #606770;
}
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* History Section Styles */
.history-section {
    margin-top: 24px;
}

.history-section .card > div { /* A more generic selector for a history item */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-section .card > div > div { /* A more generic selector for the actions container */
    display: flex;
    gap: 8px;
}

.history-section .card > div > div button { /* A more generic selector for the buttons */
    width: auto;
    padding: 6px 12px;
    font-size: 14px;
}
.options-group {
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    padding: 16px 0;
    margin-bottom: 16px;
}

.options-row {
    display: flex;
    gap: 16px;
}

.options-row .input-group {
    flex: 1;
}

.radio-group.horizontal,
.checkbox-group.horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.radio-group.horizontal label,
.checkbox-group.horizontal label {
    margin-bottom: 0;
    font-weight: normal;
}

.radio-group.horizontal input[type="radio"],
.checkbox-group.horizontal input[type="checkbox"] {
    margin-right: 4px;
}

.custom-input {
    width: 80px;
    padding: 4px 8px;
    font-size: 14px;
}
label i, button i {
    margin-right: 8px;
    vertical-align: middle;
}

button i {
    font-size: 1.1em;
}
.link-group {
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.link-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.link-header h3 {
    margin: 0;
    font-size: 1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-group.collapsed .generated-list {
    display: none;
}

.generated-list {
    padding: 15px;
}

/* Fix for history item actions layout */
.history-item-content {
   white-space: pre-wrap; /* Allows wrapping of long text */
   word-break: break-all; /* Breaks long words or URLs */
}
.history-item-actions {
    display: flex;
    flex-direction: row; /* Change to row */
    gap: 10px; /* Add gap between buttons */
    align-items: center; /* Align buttons vertically */
}

.history-item-actions button {
    min-width: auto; /* Reset min-width */
    padding: 5px 10px; /* Adjust padding */
    font-size: 0.9em; /* Make font smaller */
}
/* Navigation Styles */
nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid #e0e0e0;
}

.nav-link {
    text-decoration: none;
    color: #606770;
    padding: 12px 16px;
    border-bottom: 3px solid transparent;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    margin-bottom: -1px; /* Align with the container's border */
}

.nav-link:hover {
    color: #1877f2;
}

.nav-link.active {
    color: #1877f2;
    border-bottom-color: #1877f2;
}

/* Page visibility */
.hidden {
    display: none !important;
}

/* Page Styles */
.page {
    /* The layout is now handled by .main-content, so we remove page-specific layout rules */
}

#rewrite-page, #create-page {
    width: 100%; /* Ensure pages take full width */
}

#rewrite-page .card textarea,
#create-page .card textarea {
    min-height: 200px;
}

#create-page .main-content {
   display: grid;
   grid-template-columns: 1fr; /* Force a single column layout */
   gap: 24px;
}

#create-page .card {
    display: flex;
    flex-direction: column;
}

#step-two-container.hidden {
    display: none;
}

#outline-display {
    min-height: 250px; /* Taller textarea for the outline */
    resize: vertical;
}

#creative-output {
    min-height: 400px; /* Taller textarea for the final output */
}

#copy-creative-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    background-color: #4CAF50; /* Green color for copy */
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

#copy-creative-btn:hover {
    background-color: #45a049;
}
/* Custom File Upload Styles */
.input-group input[type="file"] {
    display: none; /* Hide the original input */
}

.input-group .file-upload-label {
    display: inline-block;
    padding: 12px 20px;
    background-color: #1877f2;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: bold;
    text-align: center;
}

.input-group .file-upload-label:hover {
    background-color: #166fe5;
}

.input-group .file-name {
    margin-left: 15px;
    color: #606770;
    font-style: italic;
    vertical-align: middle;
}

.upload-group {
    text-align: center;
}

input[type="radio"],
input[type="checkbox"] {
    accent-color: #1877f2;
}
/* Placeholder text style */
.input-group input::placeholder,
.input-group textarea::placeholder {
    color: #999; /* A lighter grey for placeholder text */
    font-style: italic;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
#drag-drop-area.drag-over {
    border: 2px dashed #007bff;
    background-color: #f0f8ff;
}