body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #343a40;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

h1 {
    color: #4a4a4a;
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: flex-end;
}

#under-logo-section {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 30px;
    width: 100%;
    margin-bottom: 30px;
}

.mode-switch {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
}

.mode-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    width: 50px;
    height: 24px;
    background-color: #ccc;
    border-radius: 12px;
    position: relative;
    margin: 0 10px;
    transition: 0.4s;
}

.slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.4s;
}

input:checked+.slider {
    background-color: #1abc9c;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

/* Button Styles */
.add-button {
    background-color: #1abc9c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s;
}

.manage-template-btn {
    background-color: #3498db;
}

.manage-template-btn:hover {
    background-color: #2980b9;
}

.add-button:hover {
    background-color: #17a689;
}

#memos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.memo-card {
    background-color: #fffac2;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    min-height: 150px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.memo-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

.memo-card h3 {
    margin-top: 0;
    border-bottom: 2px solid #f0e68c;
    padding-bottom: 5px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.memo-card p {
    font-size: 0.9em;
    color: #555;
    margin: 5px 0;
    white-space: pre-wrap;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
}

.memo-card small {
    display: block;
    margin-top: 10px;
    color: #888;
    font-size: 0.75em;
    text-align: right;
    line-height: 1.4;
}

/* Force date line break */
.memo-card small br {
    display: block;
    content: "";
}

/* === Modal (Common) === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 800px;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-body {
    overflow-y: auto;
    padding-right: 5px;
    padding-bottom: 60px;
}

#memo-modal-content .modal-body {
    padding-bottom: 80px;
}

.modal-content h2 {
    margin-top: 0;
    color: #1abc9c;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.modal-content p {
    margin-top: 2px;
    margin-bottom: 2px;
    line-height: 1;
}

.template-manager-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border: 1px solid #eee;
    margin-bottom: 8px;
    border-radius: 6px;
    background-color: #fefefe;
}

.template-manager-info strong {
    font-size: 1.1em;
    display: block;
}

.template-manager-info small {
    color: #6c757d;
}

.template-manager-actions {
    display: flex;
    gap: 10px;
}

.modal-footer-fixed {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px 20px;
    background-color: white;
    border-top: 1px solid #f0f0f0;
    border-radius: 0 0 12px 12px;
    box-sizing: border-box;
    z-index: 10;
}

.btn-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 0;
}

.btn-save,
.btn-delete,
.btn-close-modal,
.btn-copy {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: opacity 0.3s;
}

.btn-save {
    background-color: #1abc9c;
    color: white;
}

.btn-delete {
    background-color: #dc3545;
    color: white;
}

.btn-copy {
  background-color: #e0bf2b;
  color: white;
}

.btn-close-modal {
    background-color: #6c757d;
    color: white;
}

.template-manager-actions button {
    padding: 6px 12px;
    font-size: 14px;
}

.btn-delete-item {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 2px 6px;
    width: 25px;
    height: 25px;
    box-sizing: border-box;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    margin-left: 2px;
    transition: opacity 0.3s;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-delete-item:hover {
    opacity: 0.8;
}

.btn-close-modal {
    background-color: #6c757d;
    color: white;
}

input[type="text"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 15px;
    transition: border-color 0.3s;
}

/* Sort Control Radio Button Styles */
.sort-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-radio-group {
    display: flex;
    gap: 10px;
    /* 两个选项之间的距离 */
    align-items: center;
}

.sort-radio-group input[type="radio"] {
    /* 隐藏默认的 Radio 按钮 */
    display: none;
}

.sort-radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9em;
    color: #343a40;
}

/* 自定义的可见圆圈 */
.sort-radio-group label::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #ccc;
    /* 灰色边框 */
    margin-right: 8px;
    background-color: white;
    transition: all 0.2s ease;
}

/* 选中状态 - 填充圆圈颜色 */
.sort-radio-group input[type="radio"]:checked+label::before {
    background-color: #007bff;
    /* 蓝色填充 */
    border-color: #007bff;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #007bff;
    /* 模拟被选中的光晕效果 */
}

/* 鼠标悬停效果 */
.sort-radio-group label:hover::before {
    border-color: #888;
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: #1abc9c;
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group {
    margin-bottom: 10px;
}

label {
    display: block;
    margin-bottom: 3px;
    font-weight: bold;
    color: #4a4a4a;
    font-size: 0.95em;
}

.item-list {
    border: 1px dashed #ccc;
    padding: 8px;
    margin-bottom: 10px;
    border-radius: 6px;
}

.item-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: flex-start;
}

.item-row input[name="itemName"],
.item-row select {
    width: 25%;
}

.item-row .input-wrapper {
    flex-grow: 1;
}

.bool-buttons button {
    padding: 8px 15px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s, border-color 0.2s;
    margin-right: 5px;
}

.bool-buttons button.active {
    background-color: #1abc9c;
    color: white;
    border-color: #1abc9c;
}

input[type="text"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 15px;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: #1abc9c;
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* --- Sort Control Styles --- */
.sort-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

#sort-memos {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    background-color: white;
}

/* --- New Import/Export Modal Styles --- */
.import-export-section {
    padding: 10px 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.import-export-section h4 {
    margin-top: 5px;
    color: #495057;
    border-bottom: 1px dashed #ced4da;
    padding-bottom: 5px;
}

/* Make Import File input look clean */
#import-file {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: white;
}

/* PDF */
.hide-for-print {
    display: none !important;
}

@media print {

    body>*,
    body>*:not(#print-container-temp) {
        display: none !important;
    }

    #print-container-temp {
        display: block !important;
        margin: 0;
        padding: 0;
        color: #000;
        font-family: Arial, sans-serif;
        width: 100%;
    }

    .print-header {
        text-align: center;
        margin-bottom: 20px;
        padding-bottom: 10px;
        border-bottom: 2px solid #ccc;
    }

    .date-group-header {
        text-align: center;
        margin: 30px 0 15px;
        page-break-after: avoid;
        color: #555;
    }

    .print-memo-detail {
        margin-bottom: 25px;
        padding: 15px;
        border: 1px dashed #ccc;
        page-break-inside: avoid;
    }

    .print-memo-detail h3 {
        margin-top: 0;
        margin-bottom: 5px;
    }

    .print-meta-data {
        font-size: 0.8em;
        color: #666;
        margin-bottom: 10px;
        border-bottom: 1px solid #eee;
        padding-bottom: 5px;
    }

    .item-list-print {
        list-style: none;
        padding: 0;
        margin-top: 5px;
    }

    .item-list-print li {
        margin-bottom: 5px;
    }

    .item-name-print {
        font-weight: bold;
        margin-right: 5px;
    }

    .full-text-block {
        display: block;
        margin-top: 5px;
        padding-left: 10px;
        border-left: 3px solid #f0f0f0;
        white-space: pre-wrap;
    }
}

#main-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #eee;
    color: #555;
    font-size: 0.8em;
    border-top: 1px solid #ccc;
    padding: 6px 15px;
    box-sizing: border-box;
    z-index: 100;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
}

.footer-left,
.footer-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-link {
    color: #007bff;
    text-decoration: none;
    font-size: 1em;
}

.footer-link:hover {
    text-decoration: underline;
}

.footer-content {
    margin-bottom: 10px;
}

.footer-link {
    color: #007bff;
    /* 链接颜色 */
    text-decoration: none;
    margin: 0 10px;
}

.footer-link:hover {
    text-decoration: underline;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #eee;
  border-radius: 6px;
  background: #fff;
  margin-bottom: 8px;
}

.drag-handle {
  cursor: grab;
  user-select: none;
  color: #888;
  font-size: 18px;
  line-height: 1;
  padding: 0 6px;
}

.drag-handle:active {
  cursor: grabbing;
}

.item-row.dragging {
  opacity: 0.6;
}
