/* Calendar Container */
.calendar-wrapper {
    background: transparent; /* Transparent to let grid define shape */
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    border: none;
    overflow: visible; /* Don't clip children */
}

/* Calendar Header */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0;
}

.calendar-title {
    display: flex;
    gap: 12px;
    align-items: center;
}

.calendar-nav {
    display: flex;
    gap: 10px;
}

.calendar-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    height: 32px;
    white-space: nowrap;
    cursor: pointer;
    color: #606266;
    text-align: center;
    box-sizing: border-box;
    outline: none;
    transition: .1s;
    font-weight: 500;
    user-select: none;
    vertical-align: middle;
    -webkit-appearance: none;
    appearance: none;
    background-color: #fff;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    padding: 0 15px;
    font-size: 14px;
}

.calendar-btn:hover,
.calendar-btn:focus {
    color: #409eff;
    border-color: #c6e2ff;
    background-color: #ecf5ff;
    transform: none;
}

.calendar-btn:active {
    color: #409eff;
    border-color: #409eff;
    background-color: #ecf5ff;
    transform: none;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid #ebeef5; /* Restored outer border */
    border-radius: 8px;
    overflow: visible; /* FIXED: Allow overflow for popups */
    background: #fff;
}

/* Header Grid (First Child) */
.calendar-scroll-container .calendar-grid:first-child {
    border-bottom: 2px solid #f5f5f5; /* Stronger separator */
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    background: #fff; /* Clean white background */
}

/* Body Grid (Last Child) */
.calendar-scroll-container .calendar-grid:last-child {
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.calendar-day-header {
    padding: 12px 0;
    text-align: center;
    color: #1a1a1a; /* Dark text */
    font-weight: 700;
    font-size: 14px;
    background: transparent;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
}

/* Highlight Weekends in Header */
.calendar-day-header:first-child,
.calendar-day-header:last-child {
    color: #ff8e8e; /* Lighter red for contrast on black */
}

/* Remove right border from last header item */
.calendar-day-header:last-child {
    border-right: none;
}

.calendar-day {
    min-height: 140px; /* Taller cells */
    padding: 8px 12px; /* Reduced top padding */
    background: #fff;
    position: relative;
    transition: background-color 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    border-right: 1px solid #f0f0f0; /* Subtle internal borders */
    border-bottom: 1px solid #f0f0f0;
}

/* Highlight Weekends in Grid */
.calendar-day:nth-child(7n) .day-number,
.calendar-day:nth-child(7n+1) .day-number {
    color: #ff6b6b;
}

/* Remove right border from last column */
.calendar-day:nth-child(7n) {
    border-right: none;
}

/* Remove bottom border from last row */
.calendar-day:nth-last-child(-n+7) {
    border-bottom: none;
}

.calendar-day.other-month {
    background: #fdfdfd;
}

.calendar-day.other-month .day-number {
    color: #dcdcdc;
}

.calendar-day.today {
    background: #fff;
}

.calendar-day.today .day-number {
    color: #fff !important;
    background: #1a1a1a;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px; /* Squircle shape */
    font-size: 13px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    font-weight: 600;
}

.calendar-day:hover {
    background-color: #fcfcfc;
    z-index: 1;
}

.calendar-day.z-active {
    z-index: 100 !important;
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 8px;
    min-height: 28px;
}

.day-number {
    text-align: left;
    color: #1a1a1a;
    font-size: 15px;
    font-weight: 600;
    width: 28px;
    height: 28px;
    line-height: 28px;
    padding-left: 2px;
    margin-bottom: 0; /* Handled by header */
}

.calendar-diary-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    color: #999; /* Lighter grey by default */
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 2px;
    margin-right: 2px;
}

.calendar-diary-icon:hover {
    background-color: transparent;
    color: #1a1a1a;
    transform: scale(1.1);
}

.calendar-diary-icon svg {
    width: 20px;
    height: 20px;
}

/* Diary List Popup */
.calendar-diary-wrapper {
    position: relative;
    display: inline-flex;
    margin-top: 0;
    margin-right: 0;
}

.calendar-diary-list {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: -8px;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 6px; /* More square */
    box-shadow: 0 6px 16px rgba(0,0,0,0.08), 0 3px 6px -4px rgba(0,0,0,0.12);
    min-width: 240px;
    max-width: 300px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
    padding: 4px;
    text-align: left;
}

/* Triangle arrow */
.calendar-diary-list::before {
    content: '';
    position: absolute;
    top: -5px;
    right: 14px;
    width: 10px;
    height: 10px;
    background: #fff;
    border-left: 1px solid rgba(0,0,0,0.08);
    border-top: 1px solid rgba(0,0,0,0.08);
    transform: rotate(45deg);
    z-index: 1;
}

.diary-list-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 4px;
    /* border-bottom: 1px solid #f0f0f0; Removed */
    font-size: 12px;
    font-weight: 600;
    color: #909399;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.diary-count {
    background: #f4f4f5;
    color: #909399;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: normal;
}

.calendar-diary-list.align-left {
    right: auto;
    left: -8px;
}

.calendar-diary-list.align-left::before {
    right: auto;
    left: 14px;
}

.calendar-diary-wrapper.active .calendar-diary-list {
    display: block;
    animation: menuSlideIn 0.2s ease-out;
}

@keyframes menuSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.diary-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    color: #606266;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.15s;
    border-radius: 4px;
    margin: 0 2px 2px 2px;
    background: transparent;
}

.diary-list-item:hover {
    background-color: #f5f7fa;
    color: #303133;
    transform: translateX(2px);
}

.diary-link {
    flex: 1;
    color: #606266;
    text-decoration: none !important; /* Force remove underline */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
    font-weight: 500;
}

.diary-list-item:hover .diary-link {
    color: #303133;
}

/* Dark Mode Support */
body.dark-mode .calendar-diary-list {
    background: #2a2a2a;
    border-color: #333;
    box-shadow: 0 6px 16px rgba(0,0,0,0.4), 0 3px 6px -4px rgba(0,0,0,0.6);
}

body.dark-mode .calendar-diary-list::before {
    background: #2a2a2a;
    border-color: #333;
}

body.dark-mode .diary-list-title {
    border-bottom-color: #333;
    color: #909399;
}

body.dark-mode .diary-count {
    background: #333;
    color: #909399;
}

body.dark-mode .diary-list-item {
    color: #ccc;
}

body.dark-mode .diary-link {
    color: #ccc;
}

body.dark-mode .diary-list-item:hover {
    background-color: #333;
}

body.dark-mode .diary-list-item:hover .diary-link {
    color: #fff;
}

body.dark-mode .diary-edit-btn {
    color: #666;
}

body.dark-mode .diary-edit-btn:hover {
    background-color: #333;
    color: #409eff;
}

body.dark-mode .calendar-diary-list::-webkit-scrollbar-thumb {
    background: #444;
}

body.dark-mode .calendar-diary-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.diary-edit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    color: #909399;
    transition: all 0.2s;
    opacity: 0.4; /* Subtle visibility */
    flex-shrink: 0;
}

.diary-list-item:hover .diary-edit-btn {
    opacity: 1;
}

.diary-edit-btn:hover {
    background-color: #ecf5ff;
    color: #409eff;
}

.diary-edit-btn svg {
    width: 15px;
    height: 15px;
}

/* Custom Scrollbar for list */
.calendar-diary-list::-webkit-scrollbar {
    width: 4px;
}
.calendar-diary-list::-webkit-scrollbar-track {
    background: transparent;
}
.calendar-diary-list::-webkit-scrollbar-thumb {
    background: #e4e7ed;
    border-radius: 4px;
}
.calendar-diary-list::-webkit-scrollbar-thumb:hover {
    background: #c0c4cc;
}

/* Events */
.calendar-event {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s;
    margin-bottom: 4px;
    border: none;
    line-height: 1.5;
    max-width: 100%; /* Prevent overflow */
}

.calendar-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 2;
}

/* Event Colors - Modern Palette */
.event-primary { 
    background-color: #eff0fc; 
    color: #5e72e4; 
}
.event-success { 
    background-color: #e6fcf5; 
    color: #2dce89; 
}
.event-warning { 
    background-color: #fdf6ec; 
    color: #e6a23c; 
}
.event-danger  { 
    background-color: #fef0f0; 
    color: #f56c6c; 
}
.event-info {
    background-color: #f4f4f5;
    color: #909399;
}
.event-purple {
    background-color: #f3e5f5;
    color: #9c27b0;
}
.event-teal {
    background-color: #e0f2f1;
    color: #009688;
}
.event-pink {
    background-color: #fce4ec;
    color: #e91e63;
}
.event-brown {
    background-color: #efebe9;
    color: #795548;
}
.event-cyan {
    background-color: #e0f7fa;
    color: #00bcd4;
}

/* Modal */
.calendar-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.calendar-modal-overlay.show {
    display: flex;
    opacity: 1;
}

.calendar-modal {
    background: #fff;
    border-radius: 16px;
    width: 480px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.calendar-modal-overlay.show .calendar-modal {
    transform: translateY(0);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #eee;
    color: #333;
}

.modal-body {
    padding: 24px;
}

.type-options {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.type-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #555;
}

.type-option input {
    margin-right: 8px;
    accent-color: #333;
}

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

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.half {
    flex: 1;
}

/* Icon Selector */
.icon-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.icon-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #606266;
    background: #fcfcfc;
}

.icon-option svg {
    width: 20px;
    height: 20px;
    margin-bottom: 2px;
}

.icon-option span {
    font-size: 10px;
    line-height: 1;
}

.icon-option:hover {
    background: #f0f0f0;
    color: #303133;
    border-color: #dcdfe6;
}

.icon-option.selected {
    background: #ecf5ff;
    border-color: #409eff;
    color: #409eff;
    box-shadow: 0 2px 6px rgba(64, 158, 255, 0.2);
}

/* Dark Mode */
body.dark-mode .icon-option {
    background: #2a2a2a;
    border-color: #4c4d4f;
    color: #909399;
}

body.dark-mode .icon-option:hover {
    background: #333;
    border-color: #606266;
}

body.dark-mode .icon-option.selected {
    background: rgba(64, 158, 255, 0.2);
    border-color: #409eff;
    color: #409eff;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: #444;
    font-size: 14px;
    font-weight: 500;
}

.form-label.required::after {
    content: '*';
    color: #f56c6c;
    margin-left: 4px;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    color: #333;
    font-size: 14px;
    transition: all 0.2s;
    background: #fcfcfc;
}

.form-input:focus {
    border-color: #333;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

select.form-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 30px;
    cursor: pointer;
}

input[type="date"].form-input {
    -webkit-appearance: none;
    appearance: none;
    min-height: 42px;
    position: relative;
}

/* Style the date picker icon (Chrome/Edge/Safari) */
input[type="date"].form-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 5px;
}

input[type="date"].form-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Custom Select */
.custom-select-wrapper {
    position: relative;
    user-select: none;
}

.custom-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding-right: 30px; /* Space for arrow */
}

.custom-select-trigger .arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-right: 2px solid #888;
    border-bottom: 2px solid #888;
    transform: translateY(-70%) rotate(45deg);
    transition: all 0.3s;
}

.custom-select-wrapper.open .custom-select-trigger .arrow {
    transform: translateY(-30%) rotate(-135deg);
}

.custom-options {
    position: absolute;
    display: block;
    top: 100%;
    left: 0;
    right: 0;
    border: 1px solid #e0e0e0;
    border-top: 0;
    border-radius: 0 0 8px 8px;
    background: #fff;
    transition: all 0.3s;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 2050;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-top: 4px;
}

.custom-select-wrapper.open .custom-options {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateY(0);
}

.custom-option {
    position: relative;
    display: block;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-option:hover {
    background-color: #f5f5f5;
    color: #1a1a1a;
}

.custom-option.selected {
    background-color: #f0f0f0;
    font-weight: 600;
}

/* Flatpickr Overrides */
.flatpickr-calendar {
    z-index: 3000 !important; /* Above modal */
    border-radius: 8px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15) !important;
    border: 1px solid #e0e0e0 !important;
}

/* Color Radio Buttons */
.color-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.color-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    transition: all 0.2s;
}

.color-option:hover {
    background: #f5f5f5;
}

.color-option input {
    margin-right: 8px;
    accent-color: #333;
}

.color-option:has(input:checked) {
    border-color: #333;
    background: #333;
    color: #fff;
}

.color-option:has(input:checked) input {
    accent-color: #fff;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #f0f0f0;
    text-align: right;
    background: #fafafa;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn {
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border: none;
    transition: all 0.3s;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: #1a1a1a;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-primary:hover {
    background: #333;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-cancel {
    background: #fff;
    border: 1px solid #e0e0e0;
    color: #555;
}

.btn-cancel:hover {
    border-color: #ccc;
    background: #f5f5f5;
    color: #333;
}

.btn-danger {
    background: #ff4d4f;
    color: #fff;
}

.btn-danger:hover {
    background: #ff7875;
}

/* Responsive */
@media (max-width: 768px) {
    .calendar-wrapper {
        padding: 15px;
        margin: 10px 0;
    }
    
    .calendar-header {
        flex-direction: row; /* Keep row layout */
        gap: 8px; /* Tighter gap */
        align-items: center;
        margin-bottom: 15px;
        flex-wrap: nowrap; /* Prevent wrapping */
    }

    .calendar-title {
        font-size: 1.2rem;
        flex: 1; /* Take remaining space */
        gap: 6px;
        min-width: 0; /* Allow shrinking */
    }
    
    .calendar-title .calendar-dropdown {
        min-width: 0; /* Allow shrinking */
        flex: 1;
        padding: 0 6px; /* Reduced padding */
        height: 30px; /* Slightly smaller height */
    }
    
    .calendar-title .dropdown-item {
        padding: 0 10px; /* Smaller dropdown item padding */
    }

    .calendar-nav {
        gap: 6px;
        flex-shrink: 0; /* Don't shrink buttons */
    }

    .calendar-btn {
        padding: 0; /* Remove horizontal padding */
        width: 32px; /* Fixed square width */
        height: 30px; /* Match dropdown height */
        font-size: 0; /* Hide text */
        position: relative;
    }
    
    /* Icons for buttons */
    .calendar-btn.btn-prev::before {
        content: '‹';
        font-size: 20px;
        line-height: 28px;
    }
    
    .calendar-btn.btn-next::before {
        content: '›';
        font-size: 20px;
        line-height: 28px;
    }
    
    .calendar-btn.btn-today {
        display: none; /* Hide Today button on mobile to save space */
    }
    
    /* Make text visible again for accessibility if screen is slightly larger but still mobile? 
       No, keep it consistent for small screens. */
    
    .calendar-day {
        min-height: 80px;
        padding: 4px;
    }
    
    .day-number {
        font-size: 12px;
        margin-bottom: 2px;
    }
    
    .calendar-day-header {
        font-size: 12px;
        padding: 10px 0;
    }
    
    .calendar-event {
        font-size: 10px;
        padding: 2px 4px;
        margin-bottom: 1px;
        border-left-width: 2px;
    }

    .calendar-scroll-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
        margin: 0 -15px; /* Negative margin to touch screen edges */
        padding: 0 15px;
        scrollbar-width: none; /* Firefox */
    }

    .calendar-scroll-container::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
    
    .calendar-grid {
        min-width: 700px; /* Ensure enough width for text */
    }
}

/* Context Menu */
.calendar-context-menu {
    position: fixed;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border: 1px solid #ebeef5;
    padding: 6px 0;
    z-index: 3000;
    min-width: 160px;
    font-size: 14px;
    color: #606266;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background-color: #f5f7fa;
    color: #409eff;
}

.context-menu-item .menu-icon {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.context-menu-divider {
    height: 1px;
    background: #ebeef5;
    margin: 4px 0;
}

.context-menu-item.text-danger {
    color: #f56c6c;
}

.context-menu-item.text-danger:hover {
    background-color: #fef0f0;
}

.context-menu-item.disabled {
    color: #c0c4cc;
    cursor: not-allowed;
    pointer-events: none;
}

/* Calendar Dropdowns - Element Plus Style */
.calendar-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    color: #606266;
    transition: border-color 0.2s cubic-bezier(.645,.045,.355,1);
    user-select: none;
    min-width: 90px;
    box-sizing: border-box;
}

.calendar-dropdown:hover {
    border-color: #c0c4cc;
}

.calendar-dropdown.active {
    border-color: #409eff;
}

.dropdown-arrow {
    width: 12px;
    height: 12px;
    color: #c0c4cc;
    transition: transform 0.3s;
}

.calendar-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-list {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    min-width: 100%;
    /* width: fit-content; Can be wider */
    max-height: 274px; /* Element Plus max height usually around this */
    background: #fff;
    border: 1px solid #e4e7ed;
    border-radius: 4px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    z-index: 2000;
    display: none;
    padding: 6px 0;
    margin: 0;
    box-sizing: border-box;
}

/* Little arrow on top of dropdown */
.dropdown-list::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #e4e7ed; /* Border color */
}
.dropdown-list::after {
    content: "";
    position: absolute;
    top: -5px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #fff; /* Bg color */
}

.calendar-dropdown.active .dropdown-list {
    display: block;
    animation: elSelectDropdownFadeIn 0.3s cubic-bezier(.23,1,.32,1);
}

@keyframes elSelectDropdownFadeIn {
    0% { transform: scaleY(0); opacity: 0; transform-origin: center top; }
    100% { transform: scaleY(1); opacity: 1; transform-origin: center top; }
}

.dropdown-item {
    padding: 0 20px;
    height: 34px;
    line-height: 34px;
    font-size: 14px;
    color: #606266;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    text-align: left; /* Element Plus standard */
}

.dropdown-item:hover {
    background-color: #f5f7fa;
}

.dropdown-item.selected {
    color: #409eff;
    font-weight: 700;
}

/* Scrollbar for dropdown */
.dropdown-list::-webkit-scrollbar {
    width: 4px;
}
.dropdown-list::-webkit-scrollbar-thumb {
    background: #c0c4cc;
    border-radius: 3px;
}
.dropdown-list::-webkit-scrollbar-track {
    background: transparent;
}

/* Dark mode adjustments - Element Plus Dark */
body.dark-mode .calendar-dropdown {
    background: #2a2a2a;
    border-color: #4c4d4f;
    color: #cfd3dc;
}
body.dark-mode .calendar-dropdown:hover {
    border-color: #6c6e72;
    background-color: #333;
}
body.dark-mode .calendar-dropdown.active {
    border-color: #409eff;
    background-color: #333;
}
body.dark-mode .dropdown-arrow {
    color: #909399;
}
body.dark-mode .dropdown-list {
    background: #242424;
    border-color: #333;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
body.dark-mode .dropdown-list::before {
    border-bottom-color: #333;
}
body.dark-mode .dropdown-list::after {
    border-bottom-color: #242424;
}
body.dark-mode .dropdown-item {
    color: #e0e0e0;
}
body.dark-mode .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
body.dark-mode .dropdown-item.selected {
    color: #409eff;
    background-color: transparent;
    font-weight: 700;
}
body.dark-mode .dropdown-list::-webkit-scrollbar-thumb {
    background: #4c4d4f;
}
