/* =============================================
   日记插件基础样式
   时间轴和表单样式
============================================= */

/* 基础容器样式 */
.diary-plugin-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    box-sizing: border-box;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.diary-plugin-container *,
.diary-plugin-container *::before,
.diary-plugin-container *::after {
    box-sizing: inherit;
}

/* 时间轴结构 */
.diary-timeline {
    position: relative;
    padding: 40px 0;
    margin: 0 auto;
}

.diary-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: calc(100% - 80px);
    background: #e5e5e5;
    transform: translateX(-50%);
}

/* 时间轴条目 - 统一间距 */
.diary-timeline-item {
    position: relative;
    margin-bottom: 40px;
    width: 100%;
    min-height: 60px;
}

.diary-timeline-item:last-child {
    margin-bottom: 0;
}

/* 左/右对齐 */
.diary-timeline-item:nth-child(odd) {
    padding-right: 50%;
    text-align: left;
    padding-left: 0;
}

.diary-timeline-item:nth-child(even) {
    padding-left: 50%;
    text-align: left;
    padding-right: 0;
}

/* 内容框样式 */
.diary-timeline-content {
    position: relative;
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    max-width: 500px;
    transition: all 0.3s ease;
}

.diary-timeline-item:nth-child(odd) .diary-timeline-content {
    margin-left: auto;
}

.diary-timeline-item:nth-child(even) .diary-timeline-content {
    margin-right: auto;
}

.diary-timeline-content:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
}

/* 日期和元数据 */
.diary-timeline-date {
    display: block;
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 10px;
    font-weight: 500;
}

.diary-timeline-meta {
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.diary-timeline-text {
    margin-bottom: 15px;
    color: #495057;
    line-height: 1.7;
}

.diary-timeline-text p {
    margin-bottom: 1em;
}

.diary-timeline-text p:last-child {
    margin-bottom: 0;
}

/* 操作和按钮 */
.diary-timeline-actions {
    text-align: right;
    margin-top: 15px;
}

/* 时间轴标记 */
.diary-timeline-item::after {
    content: '';
    position: absolute;
    top: 25px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    z-index: 1;
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
}

.diary-timeline-item:nth-child(odd)::after {
    right: calc(50% - 10px);
    left: auto;
}

.diary-timeline-item:nth-child(even)::after {
    left: calc(50% - 10px);
    right: auto;
}

/* 心情和天气标签 */
.diary-mood,
.diary-weather {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.diary-mood {
    background-color: #f0f8f0;
    color: #4CAF50;
    border: 1px solid #e0e8e0;
}

.diary-weather {
    background-color: #f0f7f8;
    color: #2F4F4F;
    border: 1px solid #d0e0e0;
}

/* 删除链接 */
.diary-delete {
    color: #dc3545;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.diary-delete:hover {
    text-decoration: underline;
}

/* 分页 */
.diary-pagination {
    margin-top: 40px;
    text-align: center;
}

.diary-pagination .page-numbers {
    display: inline-block;
    padding: 8px 15px;
    margin: 0 3px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.diary-pagination .page-numbers.current,
.diary-pagination .page-numbers:hover {
    background-color: #4CAF50;
    color: #fff;
    border-color: #4CAF50;
}

/* 空状态 */
.diary-no-entries {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
}

/* 表单样式 */
.diary-entry-form {
    background: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 40px;
}

.diary-form-group {
    margin-bottom: 20px;
}

.diary-form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #212529;
}

.diary-form-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 15px;
    line-height: 1.5;
    min-height: 150px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    resize: vertical;
}

.diary-form-textarea:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.diary-form-select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 15px;
    line-height: 1.5;
    height: auto;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.diary-form-select:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.diary-form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.diary-form-col {
    flex: 1;
    padding: 0 10px;
    min-width: 150px;
}

.diary-submit-button {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 10px 20px;
    font-size: 16px;
    line-height: 1.5;
    border-radius: 4px;
    transition: all 0.15s ease-in-out;
    color: #fff;
    background-color: #4CAF50;
    cursor: pointer;
}

.diary-submit-button:hover {
    background-color: #3d8b40;
}

.diary-submit-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.65;
}

/* 通知和警告 */
.diary-notice {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.diary-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.diary-error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* 模态框样式 */
.diary-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.diary-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 5px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
}

.diary-modal h3 {
    margin-top: 0;
    color: #222;
}

.diary-modal p {
    margin-bottom: 20px;
}

.diary-modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.diary-button {
    padding: 8px 15px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.diary-button-primary {
    background-color: #4CAF50;
    color: #fff;
    border: 1px solid #4CAF50;
}

.diary-button-primary:hover {
    background-color: #3d8b40;
}

.diary-button-secondary {
    background-color: #fff;
    color: #333;
    border: 1px solid #ddd;
}

.diary-button-secondary:hover {
    background-color: #f5f5f5;
}

.diary-error-message {
    color: #d9534f;
    margin-top: 15px;
    font-size: 14px;
}

.diary-password-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 16px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .diary-plugin-container {
        padding: 20px 15px;
    }
    
    .diary-timeline {
        padding: 30px 0;
    }
    
    .diary-timeline::before {
        left: 30px;
        height: calc(100% - 60px);
    }
    
    .diary-timeline-item,
    .diary-timeline-item:nth-child(odd),
    .diary-timeline-item:nth-child(even) {
        padding-left: 70px;
        padding-right: 0;
        text-align: left;
        margin-bottom: 30px;
    }
    
    .diary-timeline-item:last-child {
        margin-bottom: 0;
    }
    
    .diary-timeline-item::after,
    .diary-timeline-item:nth-child(odd)::after,
    .diary-timeline-item:nth-child(even)::after {
        left: 20px;
        right: auto;
        top: 20px;
    }
    
    .diary-timeline-content {
        max-width: 100%;
    }
    
    .diary-entry-form {
        padding: 20px;
    }
    
    .diary-form-col {
        flex: 100%;
        margin-bottom: 15px;
    }
    
    .diary-form-col:last-child {
        margin-bottom: 0;
    }
}

/* 动画 */
@keyframes diary-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.diary-timeline-item {
    animation: diary-fade-in 0.3s ease-out forwards;
}

/* 过渡效果 */
.diary-read-more,
.diary-delete,
.diary-timeline-content,
.diary-submit-button {
    transition: all 0.2s ease;
}

/* 可访问性焦点状态 */
.diary-read-more:focus,
.diary-delete:focus,
.diary-submit-button:focus,
.diary-form-select:focus,
.diary-form-textarea:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* 打印样式 */
@media print {
    .diary-plugin-container {
        padding: 0;
        max-width: 100%;
    }
    
    .diary-timeline {
        padding: 0;
    }
    
    .diary-timeline::before {
        display: none;
    }
    
    .diary-timeline-item {
        page-break-inside: avoid;
        margin-bottom: 20pt;
    }
    
    .diary-timeline-item::after {
        display: none;
    }
    
    .diary-timeline-content {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .diary-delete,
    .diary-timeline-actions,
    .diary-entry-form {
        display: none;
    }
    
    .diary-timeline-date {
        color: #000;
        font-weight: bold;
    }
}