body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f6f8;
    color: #333;
    margin: 0;
    padding: 0; /* Let the container handle padding */
}

.container {
    max-width: 1200px;
    margin: 20px auto; /* Add top/bottom margin */
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
    text-align: center;
    color: #2c3e50;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 12px 15px;
    border: 1px solid #ddd;
    text-align: left;
}

thead {
    background-color: #34495e;
    color: #fff;
}

tbody tr:nth-child(even) {
    background-color: #f2f2f2;
}

tbody tr:hover {
    background-color: #e8f4f8;
}

.direction-long {
    color: #27ae60;
    font-weight: bold;
}

.direction-short {
    color: #c0392b;
    font-weight: bold;
}

.details-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.details-button:hover {
    background-color: #2980b9;
}

.pagination-controls {
    margin-top: 20px;
    text-align: center;
    display: flex; /* 使用 flexbox 布局 */
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
    flex-wrap: wrap; /* 允许换行 */
    gap: 8px; /* 按钮之间的间距 */
}

.pagination-controls button {
    background-color: #ecf0f1;
    border: 1px solid #bdc3c7;
    color: #2c3e50;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.pagination-controls button:hover:not(:disabled) {
    background-color: #d5dbdb;
}

.pagination-controls button.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination-controls button:disabled {
    background-color: #f4f6f8;
    color: #95a5a6;
    cursor: not-allowed;
}

.pagination-controls .pagination-info { /* Changed from .page-info to .pagination-info */
    margin: 0 10px;
    font-weight: bold;
    color: #555;
}

/* Modal styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px;
    border-radius: 8px;
    position: relative;
}

.modal-content.large-modal {
    max-width: 900px; /* Wider modal for two columns */
}

.record-details-container {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

.details-column {
    flex: 1; /* 1:1 split */
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #eee;
}

.details-column h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ddd;
    color: #2c3e50;
    text-align: center;
}

.details-column.left-column h3 {
    border-color: #3498db;
}

.details-column.right-column h3 {
    border-color: #e67e22;
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
}

pre {
    background-color: #eee;
    padding: 15px;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
}
/* Action Bar Styles */
.actions-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 15px;
}

.actions-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.actions-container select,
.actions-container button {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #bdc3c7;
}

.actions-container button {
     background-color: #ecf0f1;
     cursor: pointer;
}

.manage-link {
    color: #3498db;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 12px;
    border: 1px solid #3498db;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}

.manage-link:hover {
    background-color: #3498db;
    color: white;
}

.status-message {
    min-height: 1.2em; /* Reserve space to prevent layout shift */
    margin-bottom: 10px;
}

.status-message:empty {
    min-height: 0;
    margin: 0;
    padding: 0;
}

/* Management Page Specific Styles */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-bar a {
    text-decoration: none;
    color: #3498db;
    font-size: 1em;
}

#assets-table .delete-asset-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#assets-table .delete-asset-btn:hover {
    background-color: #c0392b;
}

.modal .form-group {
    margin-bottom: 15px;
}

.modal .form-group label {
    display: block;
    margin-bottom: 5px;
}

.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Important for width */
}


/* Schedule Feature Styles */
#assets-table .not-set {
    color: #95a5a6;
    font-style: italic;
}

#assets-table td code {
    background-color: #ecf0f1;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: "Courier New", Courier, monospace;
}

.modal-content small {
    display: block;
    margin-top: 10px;
    color: #7f8c8d;
    line-height: 1.5;
}

.modal-content small code {
    background-color: #e8f4f8;
    padding: 1px 4px;
    border-radius: 3px;
}

#assets-table .set-schedule-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#assets-table .set-schedule-btn:hover {
    background-color: #2980b9;
}

#assets-table .trigger-analysis-btn {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#assets-table .trigger-analysis-btn:hover {
    background-color: #229954;
}

#assets-table .trigger-analysis-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* Add margin between buttons in the same cell */
#assets-table td button + button {
    margin-left: 8px;
}

/* Prompts Page Specific Styles */
#prompts-table .action-btn {
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 0.9em;
}

#prompts-table .view-prompt-btn {
    background-color: #3498db; /* Blue */
}

#prompts-table .view-prompt-btn:hover {
    background-color: #2980b9;
}

#prompts-table .delete-prompt-btn {
    background-color: #e74c3c; /* Red */
}

#prompts-table .delete-prompt-btn:hover {
    background-color: #c0392b;
}

#prompts-table .activate-prompt-btn {
    background-color: #27ae60; /* Green */
}

#prompts-table .activate-prompt-btn:hover {
    background-color: #229954;
}

#prompts-table .activate-prompt-btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Add margin between buttons in the same cell */
#prompts-table td .action-btn + .action-btn {
    margin-left: 8px;
}

#prompts-table .col-actions {
    width: 220px;
    white-space: nowrap;
    text-align: center;
}

/* Global Navigation Bar Styles */
.main-nav {
    background-color: #34495e;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* margin-bottom is now handled by container's margin-top */
}

.main-nav .nav-brand {
    color: #ecf0f1;
    font-size: 1.5em;
    font-weight: bold;
    text-decoration: none;
    padding: 15px 0;
}

.main-nav .nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.main-nav .nav-links li {
    margin-left: 20px;
}

.main-nav .nav-links a {
    color: #ecf0f1;
    text-decoration: none;
    font-size: 1em;
    padding: 20px 10px;
    display: block;
    transition: background-color 0.3s;
}

.main-nav .nav-links a:hover,
.main-nav .nav-links a.active {
    background-color: #4a627a;
}

/* Button in toolbar */
.toolbar button {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 1em;
}

.toolbar button:hover {
    background-color: #229954;
}

/* Primary button inside modals */
.modal .button-primary,
.modal button[type="submit"] {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 1em;
    width: 100%;
    margin-top: 10px;
}

.modal .button-primary:hover,
.modal button[type="submit"]:hover {
    background-color: #229954;
}

/* Plan Details Modal Specific Styles */
#plan-details-content {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two-column layout */
    gap: 15px 20px; /* Row and column gap */
    padding-top: 10px;
}

.detail-item {
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.detail-item strong {
    display: block;
    color: #555;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.detail-item span {
    font-size: 1em;
    color: #333;
    word-wrap: break-word; /* Ensure long content wraps */
}

/* Make reason span the full width */
.detail-item.full-width {
    grid-column: 1 / -1;
}

/* Timeline Styles */
.timeline-section {
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.timeline-section h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    text-align: center;
}

.timeline {
    position: relative;
    padding-left: 30px;
    border-left: 2px solid #e0e0e0;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-marker {
    position: absolute;
    left: -36px; /* Adjust based on border and size */
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #e0e0e0;
}

.timeline-marker.action-open {
    background-color: #27ae60;
    box-shadow: 0 0 0 2px #27ae60;
}

.timeline-marker.action-close {
    background-color: #c0392b;
    box-shadow: 0 0 0 2px #c0392b;
}

.timeline-marker.action-hold {
    background-color: #f39c12;
    box-shadow: 0 0 0 2px #f39c12;
}

.timeline-marker.action-default {
    background-color: #95a5a6;
}

.timeline-content {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 10px 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.timeline-time {
    font-size: 0.85em;
    color: #7f8c8d;
    font-weight: bold;
}

.timeline-action.badge {
    font-size: 0.8em;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
}

.timeline-action.action-open { background-color: #27ae60; }
.timeline-action.action-close { background-color: #c0392b; }
.timeline-action.action-hold { background-color: #f39c12; }
.timeline-action.action-default { background-color: #95a5a6; }

.timeline-reason {
    margin: 5px 0;
    font-size: 0.95em;
    color: #34495e;
    line-height: 1.4;
}

.tag {
    display: inline-block;
    background-color: #ecf0f1;
    color: #555;
    font-size: 0.8em;
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 5px;
    margin-top: 5px;
}
