/* Unified Modern Design for Timetainer */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --light-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
    --transition: all 0.2s ease-in-out;
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--light-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Header Styles */
.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Unified Header Styles */
.unified-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
    padding: 1.5rem 0; /* More compact */
    text-align: center;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0;
}

.unified-header .site-title {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Global Navigation - Fixed Top Right */
.global-navigation {
    position: fixed;
    top: 100px; /* Below header with proper spacing */
    right: 20px;
    width: 120px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    padding: 12px 0;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin: 0;
    padding: 0 12px;
}

.nav-link {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 0;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.1);
}

.nav-link.active {
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.1);
    font-weight: 600;
}

/* Content wrapper to center content */
.content-wrapper {
    max-width: 1200px;
    margin: 0 auto 3rem auto;
    padding: 0 1rem;
}

/* Diary Entry List Styles */
.diary-entry-card {
    padding: 0.75rem 1rem !important;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.diary-entry-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
}

.entry-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 !important;
    line-height: 1.4;
}

.entry-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Container Styles */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto 3rem auto;
}

/* Card Styles */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 2rem;
    border: none;
}

.card-header {
    background: var(--card-bg);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 2rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    border: 2px solid transparent;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--light-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Diary Entry Styles */
.diary-entry {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 2rem;
}

.diary-entry-header {
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 1px solid var(--border-color);
}

.diary-entry-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    line-height: 1.3;
}

.diary-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.diary-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.diary-content {
    padding: 2rem;
    line-height: 1.8;
    font-size: 1.05rem;
    color: var(--text-primary);
    min-height: 200px;
}

.diary-content p {
    margin: 1.25rem 0;
    text-align: left;
}

.diary-content h1, .diary-content h2, .diary-content h3 {
    margin: 2rem 0 1rem 0;
    color: var(--text-primary);
    font-weight: 700;
}

.diary-content h1 { font-size: 1.75rem; }
.diary-content h2 { font-size: 1.5rem; }
.diary-content h3 { font-size: 1.25rem; }

.diary-content ul, .diary-content ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.diary-content li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.diary-actions {
    padding: 1.5rem 2rem;
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Rich Text Editor */
.editor-container {
    margin-bottom: 2rem;
}

#editor {
    height: 400px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition);
}

#editor:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Alert Styles */
.alert {
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border: none;
    font-weight: 500;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 2rem;
        padding: 1.5rem 0;
    }
    
    .main-container {
        padding: 0 1rem;
    }
    
    .content-wrapper {
        padding: 0;
    }
    
    .card-body, .diary-content, .diary-entry-header, .diary-actions {
        padding: 1.5rem;
    }
    
    .diary-entry-title {
        font-size: 1.5rem;
    }
    
    .diary-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .diary-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    #editor {
        height: 300px;
    }
    
    /* Mobile navigation adjustment */
    .global-navigation {
        position: static;
        width: auto;
        margin: 1rem 0;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    .nav-item {
        padding: 0;
    }
    
    .nav-link {
        padding: 12px 16px;
        font-size: 1rem;
    }
}

/* Calendar Styles */
.calendar-container {
    max-width: 1000px;
    margin: 0 auto;
}

.calendar-header {
    text-align: center;
}

.calendar-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: #1e293b;
}

.calendar-grid {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: block;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.calendar-day-header {
    padding: 12px 0;
    text-align: center;
    font-weight: 600;
    color: #64748b;
    font-size: 1rem;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    /* 不再固定行数，让内容自然流动 */
    gap: 1px;
    background: #e2e8f0;
}

.calendar-day {
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
    min-height: 120px; /* 设置最小高度而不是固定高度 */
}

.calendar-day:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}

.calendar-day.empty {
    background: #f8fafc;
    cursor: default;
}

.calendar-day.has-entry {
    background: #f0f9ff;
    border-left: 3px solid #4f46e5;
}

.calendar-day.today {
    background: #fffbeb;
    border: 2px solid #f59e0b;
}

.day-number {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
    font-size: 1.1rem;
}

.entry-preview {
    font-size: 0.9rem;
    color: #4f46e5;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    margin-top: auto;
}

/* Monthly Summary Calendar Styles */
.monthly-summary-calendar {
    max-width: 1200px;
    margin: 0 auto;
}

.summary-year-selector {
    text-align: center;
    margin-bottom: 2rem;
}

.summary-year-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1rem;
}

.summary-months-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.summary-month-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

.summary-month-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.15);
}

.summary-month-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.summary-month-status {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.summary-month-content {
    font-size: 0.85rem;
    color: #4f46e5;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    margin-top: auto;
}

.summary-month-empty {
    color: #94a3b8;
    font-style: italic;
}

.summary-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.summary-action-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* Responsive Design for Monthly Summary */
@media (max-width: 768px) {
    .summary-months-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .summary-month-card {
        padding: 1rem;
        min-height: 100px;
    }
    
    .summary-month-name {
        font-size: 1.1rem;
    }
    
    .summary-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .summary-action-btn {
        width: 100%;
        justify-content: center;
    }
}