/* Calendar Modal */
.calendar-modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1001 !important;
}

.calendar-modal-content {
    max-width: 1000px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.dark .calendar-modal-content {
    background: #1a202c;
}

.calendar-modal-content .modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 1.5rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.dark .calendar-modal-content .modal-header {
    border-bottom-color: #2d3748 !important;
}

.calendar-modal-content .modal-title {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: #1a202c !important;
    margin: 0 !important;
}

.dark .calendar-modal-content .modal-title {
    color: #f7fafc !important;
}

.calendar-modal-content .modal-close {
    background: none !important;
    border: none !important;
    font-size: 1.5rem !important;
    cursor: pointer !important;
    color: #718096 !important;
    padding: 0 !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: auto !important;
}

.calendar-modal-content .modal-close:hover {
    color: #2d3748 !important;
}

.dark .calendar-modal-content .modal-close:hover {
    color: #e2e8f0 !important;
}

.calendar-modal-body {
    display: flex;
    gap: 2rem;
    overflow: hidden;
    flex: 1;
    padding: 1.5rem;
}

/* Calendar */
#calendar-container {
    flex: 0 0 350px;
    display: flex;
    flex-direction: column;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.calendar-month-year {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1a202c;
    min-width: auto;
    text-align: center;
    flex: 1;
}

.dark .calendar-month-year {
    color: #f7fafc;
}

.calendar-nav-btn {
    background: #e2e8f0;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.dark .calendar-nav-btn {
    background: #2d3748;
    color: #e2e8f0;
}

.calendar-nav-btn:hover {
    background: #cbd5e0;
}

.dark .calendar-nav-btn:hover {
    background: #4a5568;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.25rem;
}

.weekday {
    text-align: center;
    font-weight: 600;
    font-size: 0.65rem;
    color: #718096;
    padding: 0.25rem 0;
}

.dark .weekday {
    color: #cbd5e0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
    position: relative;
    font-size: 0.65rem;
    padding: 0.125rem;
}

.dark .calendar-day {
    background: #2d3748;
    border-color: #4a5568;
}

.calendar-day.empty {
    cursor: default;
    background: transparent;
    border: none;
}

.calendar-day:not(.empty):hover {
    background: #f7fafc;
    border-color: #1173d4;
}

.dark .calendar-day:not(.empty):hover {
    background: #374151;
    border-color: #63b3ed;
}

.calendar-day.today {
    border: 2px solid #1173d4;
    font-weight: 600;
}

.dark .calendar-day.today {
    border-color: #63b3ed;
}

.calendar-day.has-notes {
    background: #dcfce7;
    border-color: #22c55e;
}

.dark .calendar-day.has-notes {
    background: #166534;
    border-color: #22c55e;
}

.calendar-day.weekend {
    background: #fee2e2;
    border-color: #fca5a5;
}

.dark .calendar-day.weekend {
    background: #7f1d1d;
    border-color: #fca5a5;
}

.calendar-day.weekend .calendar-day-number {
    color: #991b1b;
}

.dark .calendar-day.weekend .calendar-day-number {
    color: #fecaca;
}

.calendar-day.has-notes.weekend {
    background: #dcfce7;
    border-color: #22c55e;
}

.dark .calendar-day.has-notes.weekend {
    background: #166534;
    border-color: #22c55e;
}

.calendar-day-number {
    font-weight: 500;
    color: #1a202c;
}

.dark .calendar-day-number {
    color: #f7fafc;
}

.calendar-day.has-notes .calendar-day-number {
    color: #15803d;
}

.dark .calendar-day.has-notes .calendar-day-number {
    color: #86efac;
}

.calendar-day-indicator {
    width: 2px;
    height: 2px;
    background: #22c55e;
    border-radius: 50%;
    position: absolute;
    bottom: 1px;
}

/* Day Notes */
#day-notes-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
    overflow: hidden;
}

.day-notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.day-notes-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1a202c;
    flex: 1;
}

.dark .day-notes-title {
    color: #f7fafc;
}

.day-notes-add-btn {
    background: #1173d4;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.day-notes-add-btn:hover {
    background: #0e5ba8;
    transform: scale(1.1);
}

.day-notes-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.empty-notes {
    text-align: center;
    color: #718096;
    padding: 1rem 0.5rem;
    font-size: 0.875rem;
}

.dark .empty-notes {
    color: #cbd5e0;
}

.day-note-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f7fafc;
    border-radius: 0.25rem;
    border-left: 2px solid #1173d4;
    word-break: break-word;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.day-note-item:hover {
    background: #f1f5f9;
    border-left-color: #0e5ba8;
}

.dark .day-note-item {
    background: #2d3748;
    border-left-color: #63b3ed;
}

.dark .day-note-item:hover {
    background: #374151;
    border-left-color: #3b82f6;
}

.day-note-text {
    flex: 1;
    color: #2d3748;
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.dark .day-note-text {
    color: #e2e8f0;
}

.day-note-delete {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.day-note-delete:hover {
    color: #dc2626;
    transform: scale(1.2);
}

.day-notes-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.day-note-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    background: white;
    color: #2d3748;
    font-size: 0.95rem;
}

.dark .day-note-input {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

.day-note-input:focus {
    outline: none;
    border-color: #1173d4;
    box-shadow: 0 0 0 3px rgba(17, 115, 212, 0.1);
}

.day-note-textarea {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    background: white;
    color: #2d3748;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    max-height: 200px;
}

.dark .day-note-textarea {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

.day-note-textarea:focus {
    outline: none;
    border-color: #1173d4;
    box-shadow: 0 0 0 3px rgba(17, 115, 212, 0.1);
}

.day-note-add-btn {
    background: #1173d4;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.day-note-add-btn:hover {
    background: #0e5ba8;
}

/* Calendar Button */
#calendar-btn.has-events {
    animation: calendar-pulse 1.5s ease-in-out infinite;
}

@keyframes calendar-pulse {
    0%, 100% {
        background: #e2e8f0;
        color: #2d3748;
    }
    50% {
        background: #22c55e;
        color: white;
    }
}

.dark #calendar-btn.has-events {
    animation: calendar-pulse-dark 1.5s ease-in-out infinite;
}

@keyframes calendar-pulse-dark {
    0%, 100% {
        background: #2d3748;
        color: #e2e8f0;
    }
    50% {
        background: #22c55e;
        color: white;
    }
}

/* Confirm Modal */
.confirm-modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1002 !important;
}

.confirm-modal-content {
    background: white;
    border-radius: 0.75rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.dark .confirm-modal-content {
    background: #1e293b;
}

.confirm-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.confirm-message {
    font-size: 1.125rem;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.dark .confirm-message {
    color: #f1f5f9;
}

.confirm-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.confirm-cancel,
.confirm-ok {
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-cancel {
    background: #e5e7eb;
    color: #374151;
}

.confirm-cancel:hover {
    background: #d1d5db;
}

.dark .confirm-cancel {
    background: #374151;
    color: #f3f4f6;
}

.dark .confirm-cancel:hover {
    background: #4b5563;
}

.confirm-ok {
    background: #ef4444;
    color: white;
}

.confirm-ok:hover {
    background: #dc2626;
}

/* Responsive */
@media (max-width: 768px) {
    .calendar-modal-body {
        flex-direction: column;
        gap: 1rem;
    }

    #calendar-container {
        flex: 0 0 auto;
    }

    #day-notes-container {
        min-width: auto;
    }

    .calendar-days {
        gap: 0.25rem;
    }

    .calendar-day {
        font-size: 0.75rem;
    }
}


/* Note Modal */
.note-modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1003 !important;
}

.note-modal-content {
    background: white;
    border-radius: 0.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.dark .note-modal-content {
    background: #1a202c;
}

.note-modal-content .modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 1.5rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.dark .note-modal-content .modal-header {
    border-bottom-color: #2d3748 !important;
}

.note-modal-content .modal-title {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: #1a202c !important;
    margin: 0 !important;
}

.dark .note-modal-content .modal-title {
    color: #f7fafc !important;
}

.note-modal-content .modal-close {
    background: none !important;
    border: none !important;
    font-size: 1.5rem !important;
    cursor: pointer !important;
    color: #718096 !important;
    padding: 0 !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: auto !important;
}

.note-modal-content .modal-close:hover {
    color: #2d3748 !important;
}

.dark .note-modal-content .modal-close:hover {
    color: #e2e8f0 !important;
}

.note-modal-content .modal-body {
    padding: 1.5rem !important;
    flex: 1 !important;
    overflow-y: auto !important;
}

.note-modal-content .modal-footer {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 0.5rem !important;
    padding: 1rem 1.5rem !important;
    border-top: 1px solid #e2e8f0 !important;
}

.dark .note-modal-content .modal-footer {
    border-top-color: #2d3748 !important;
}

.note-modal-textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    background: white;
    color: #2d3748;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 200px;
}

.dark .note-modal-textarea {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

.note-modal-textarea:focus {
    outline: none;
    border-color: #1173d4;
    box-shadow: 0 0 0 3px rgba(17, 115, 212, 0.1);
}

.note-view-text {
    padding: 1rem;
    color: #2d3748;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: #f7fafc;
    border-radius: 0.375rem;
    max-height: 400px;
    overflow-y: auto;
}

.dark .note-view-text {
    background: #2d3748;
    color: #e2e8f0;
}
