/* Enhanced responsive design and visual polish */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

/* Loading and error states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #e74c3c;
    font-size: 1.2rem;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    border: 2px dashed #e74c3c;
}

/* Enhanced container with better responsive behavior */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 350px;
    grid-template-rows: auto auto 1fr;
    gap: 20px;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.header {
    grid-column: 1 / -1;
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    color: #7f8c8d;
    font-weight: 300;
}

.calendar-navigation {
    grid-column: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.nav-btn {
    background: #667eea;
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.nav-btn:hover:not(:disabled) {
    background: #5a6fd8;
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.nav-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.nav-btn:active:not(:disabled) {
    transform: scale(0.95);
}

/* Add ripple effect */
.nav-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: width 0.3s, height 0.3s, top 0.3s, left 0.3s;
    transform: translate(-50%, -50%);
}

.nav-btn:active:not(:disabled)::before {
    width: 100px;
    height: 100px;
}

.month-display {
    text-align: center;
    min-width: 300px;
}

.month-title-en, .month-title-ch {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: #2c3e50;
    margin: 5px 0;
}

.month-title-ch {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', serif;
    font-size: 1.8rem;
    color: #e74c3c;
}

.calendar-container {
    grid-column: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.month-flower {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px solid #dee2e6;
}

.flower-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 3px solid rgba(102, 126, 234, 0.3);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #ff6b9d 0%, #c44569 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.flower-image:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.flower-info {
    flex: 1;
}

.flower-name-pt {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 5px;
}

.flower-name-en {
    font-size: 1.4rem;
    color: #667eea;
    margin-bottom: 5px;
}

.flower-name-ch {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', serif;
    font-size: 1.6rem;
    color: #e74c3c;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
}

.day-header {
    background: #34495e;
    color: white;
    padding: 15px 5px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.day-cell {
    background: white;
    min-height: 80px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    border-radius: 4px;
    margin: 1px;
}

.day-cell:hover:not(.other-month) {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.day-cell:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.day-cell.selected {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.day-cell.current-date {
    background: #e74c3c;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.day-cell.weekend:not(.selected):not(.current-date) {
    background: #f8f9fa;
    color: #7f8c8d;
}

.day-cell.other-month {
    background: #ecf0f1;
    color: #bdc3c7;
    cursor: default;
}

.day-cell.other-month:hover {
    transform: none;
    box-shadow: none;
}

.day-number {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.sidebar {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar > div {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.sidebar > div:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.sidebar h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: #2c3e50;
    margin-bottom: 15px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.sidebar h4 {
    font-size: 1.1rem;
    color: #34495e;
    margin-bottom: 8px;
    margin-top: 15px;
}

.sidebar h4:first-child {
    margin-top: 0;
}

.sidebar p {
    line-height: 1.6;
    color: #555;
    margin-bottom: 10px;
}

/* Enhanced responsive design */
@media (max-width: 1200px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        max-width: 100%;
    }
    
    .sidebar {
        grid-column: 1;
        grid-row: 4;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }
    
    .calendar-container {
        grid-column: 1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
        gap: 15px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .month-title-en, .month-title-ch {
        font-size: 1.6rem;
    }
    
    .month-title-ch {
        font-size: 1.4rem;
    }
    
    .calendar-navigation {
        padding: 15px;
        gap: 20px;
    }
    
    .nav-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .month-display {
        min-width: 250px;
    }
    
    .calendar-container {
        padding: 20px;
    }
    
    .month-flower {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .flower-image {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
    }
    
    .flower-name-pt {
        font-size: 1.6rem;
    }
    
    .flower-name-en {
        font-size: 1.2rem;
    }
    
    .flower-name-ch {
        font-size: 1.4rem;
    }
    
    .day-cell {
        min-height: 60px;
        padding: 5px;
    }
    
    .day-number {
        font-size: 1rem;
    }
    
    .sidebar {
        grid-template-columns: 1fr;
    }
    
    .sidebar > div {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .calendar-navigation {
        padding: 10px;
        gap: 15px;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .month-display {
        min-width: 200px;
    }
    
    .month-title-en, .month-title-ch {
        font-size: 1.4rem;
    }
    
    .month-title-ch {
        font-size: 1.2rem;
    }
    
    .calendar-container {
        padding: 15px;
    }
    
    .month-flower {
        padding: 15px;
    }
    
    .flower-image {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
    
    .flower-name-pt {
        font-size: 1.4rem;
    }
    
    .flower-name-en {
        font-size: 1.1rem;
    }
    
    .flower-name-ch {
        font-size: 1.3rem;
    }
    
    .day-cell {
        min-height: 50px;
        padding: 3px;
    }
    
    .day-number {
        font-size: 0.9rem;
    }
    
    .day-header {
        padding: 10px 3px;
        font-size: 0.8rem;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
    }
    
    .container {
        max-width: 100%;
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .header {
        background: white;
        box-shadow: none;
    }
    
    .calendar-navigation {
        display: none;
    }
    
    .sidebar {
        display: none;
    }
    
    .calendar-container {
        background: white;
        box-shadow: none;
    }
    
    .day-cell {
        border: 1px solid #ddd;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .day-cell {
        border: 2px solid #000;
    }
    
    .day-cell.selected {
        background: #000;
        color: #fff;
    }
    
    .day-cell.current-date {
        background: #000;
        color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    .header, .calendar-navigation, .calendar-container, .sidebar > div {
        background: rgba(52, 73, 94, 0.95);
        color: #ecf0f1;
    }
    
    .header h1, .month-title-en, .sidebar h3 {
        color: #ecf0f1;
    }
    
    .day-cell {
        background: #34495e;
        color: #ecf0f1;
    }
    
    .day-cell:hover:not(.other-month) {
        background: #3c5a78;
    }
    
    .day-cell.other-month {
        background: #2c3e50;
        color: #7f8c8d;
    }
}
