/**
 * Enhanced Calendar View Styles
 * Modern, visually appealing calendar with animations and better UX
 */

/* ============================================
   Calendar Container
   ============================================ */
.calendar {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.calendar table {
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 8px;
}

.calendar table.month {
    display: none;
    width: 100%;
}

/* ============================================
   Calendar Header (Month Navigation)
   ============================================ */
.calendar table th {
    text-align: center;
    font-size: 1.5em;
    font-weight: 600;
    background: linear-gradient(135deg, #5b9bd5 0%, #4a8cc7 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px;
    padding: 15px 10px;
    box-shadow: 0 4px 12px rgba(91, 155, 213, 0.25);
}

.calendar-nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.calendar-nav-wrapper .month-title {
    flex: 1;
    text-align: center;
    font-size: 1.1em;
    font-weight: 600;
    color: white;
    letter-spacing: 0.5px;
}

.calendar-nav-wrapper .arrow-prev,
.calendar-nav-wrapper .arrow-next {
    cursor: pointer;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white !important;
    text-decoration: none !important;
    font-size: 0.9em;
}

.calendar-nav-wrapper .arrow-prev:hover,
.calendar-nav-wrapper .arrow-next:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.calendar-nav-wrapper .arrow-prev:active,
.calendar-nav-wrapper .arrow-next:active {
    transform: scale(1.05);
}

/* ============================================
   Day of Week Header Row
   ============================================ */
.calendar table thead:nth-child(2) th {
    background: linear-gradient(180deg, #f8f9fc 0%, #e9ecef 100%) !important;
    color: #495057 !important;
    font-size: 0.95em;
    font-weight: 600;
    padding: 12px 8px;
    border-bottom: 2px solid #dee2e6;
}

.calendar table thead:nth-child(2) th .day-icon {
    margin-right: 6px;
    opacity: 0.8;
    font-size: 0.9em;
}

/* Icon colors for each day (Hindu tradition) */
.calendar table thead:nth-child(2) th:nth-child(1) .day-icon { color: #6c757d; } /* Monday - Moon (gray) */
.calendar table thead:nth-child(2) th:nth-child(2) .day-icon { color: #dc3545; } /* Tuesday - Fire/Hanuman (red) */
.calendar table thead:nth-child(2) th:nth-child(3) .day-icon { color: #28a745; } /* Wednesday - Book/Ganesha (green) */
.calendar table thead:nth-child(2) th:nth-child(4) .day-icon { color: #ffc107; } /* Thursday - Guru/Jupiter (yellow) */
.calendar table thead:nth-child(2) th:nth-child(5) .day-icon { color: #17a2b8; } /* Friday - Lakshmi/Venus (cyan) */
.calendar table thead:nth-child(2) th:nth-child(6) .day-icon { color: #343a40; } /* Saturday - Shani (dark) */
.calendar table thead:nth-child(2) th:nth-child(7) .day-icon { color: #fd7e14; } /* Sunday - Sun (orange) */

/* ============================================
   Calendar Cells (Days)
   ============================================ */
.calendar table td {
    width: 14%;
    padding: 8px;
    height: 140px;
    vertical-align: top;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Regular days */
.calendar table td.activity,
.calendar table td.inactivity {
    border: 2px solid #e0e5eb;
    border-radius: 12px;
    position: relative;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Active days with tasks */
.calendar table td.activity {
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fc 100%) !important;
}

/* Hover effect on days with tasks */
.calendar table td.activity:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(91, 155, 213, 0.15) !important;
    border-color: #5b9bd5 !important;
}

/* Past/inactive days */
.calendar table td.inactivity {
    background: #f5f5f5;
    opacity: 0.6;
}

/* Today's date - Make it POP! */
.calendar table td.today {
    background: linear-gradient(135deg, #fff4e6 0%, #ffe4cc 100%) !important;
    border: 3px solid #ff9800 !important;
    box-shadow: 0 8px 24px rgba(255, 152, 0, 0.3),
                0 0 0 4px rgba(255, 152, 0, 0.1) !important;
    animation: pulse-today 2s ease-in-out infinite !important;
    transform: scale(1.02) !important;
}

.calendar table td.activity.today,
.calendar table td.inactivity.today {
    background: linear-gradient(135deg, #fff4e6 0%, #ffe4cc 100%) !important;
}

@keyframes pulse-today {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(255, 152, 0, 0.3),
                    0 0 0 4px rgba(255, 152, 0, 0.1);
    }
    50% {
        box-shadow: 0 8px 24px rgba(255, 152, 0, 0.4),
                    0 0 0 6px rgba(255, 152, 0, 0.15);
    }
}

/* Weekend styling */
.calendar table td:nth-child(6),
.calendar table td:nth-child(7) {
    background: linear-gradient(180deg, #f8f9fc 0%, #f0f2f8 100%);
}

.calendar table td.today:nth-child(6),
.calendar table td.today:nth-child(7) {
    background: linear-gradient(135deg, #fff4e6 0%, #ffe4cc 100%) !important;
}

/* ============================================
   Date Number Box
   ============================================ */
.calendar table td .date-box {
    left: 8px;
    top: 8px;
    height: 32px;
    width: 32px;
    position: absolute;
    font-size: 1em;
    font-weight: 600;
    line-height: 32px;
    background: linear-gradient(135deg, #5b9bd5 0%, #4a8cc7 100%);
    color: white;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(91, 155, 213, 0.25);
    transition: all 0.3s ease;
    padding: 0;
}

.calendar table td:hover .date-box {
    transform: scale(1.1);
}

/* Today's date number - Extra special! */
.calendar table td .date-box-today {
    left: 8px;
    top: 8px;
    height: 40px;
    width: 40px;
    position: absolute;
    font-size: 1.3em;
    font-weight: 700;
    line-height: 40px;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%) !important;
    color: white !important;
    text-align: center;
    border-radius: 50% !important;
    box-shadow: 0 4px 16px rgba(255, 152, 0, 0.4) !important;
    padding: 0;
    border: 3px solid white !important;
    animation: bounce-date 1s ease-in-out 2;
    z-index: 5;
}

@keyframes bounce-date {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================
   Task List within Day
   ============================================ */
.calendar table td .model-box {
    position: absolute;
    font-size: 0.85em;
    line-height: 1.5;
    top: 48px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

.calendar table td .model-box > * {
    display: block;
    margin-bottom: 2px;
}

/* Task item styling */
.calendar table td .model-box .task-item {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 3px;
    line-height: 1.3;
    overflow: hidden;
}

.calendar table td .model-box .task-item a {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Custom scrollbar for task list */
.calendar table td .model-box::-webkit-scrollbar {
    width: 4px;
}

.calendar table td .model-box::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.calendar table td .model-box::-webkit-scrollbar-thumb {
    background: #5b9bd5;
    border-radius: 10px;
}

.calendar table td .model-box::-webkit-scrollbar-thumb:hover {
    background: #4a8cc7;
}

.calendar table td .model-box a {
    color: #1a1a1a;
    font-size: 0.95em;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline;
    padding: 0;
    vertical-align: middle;
}

.calendar table td .model-box a:hover {
    color: #5b9bd5;
}

/* Task bullet shapes with enhanced styling */
.dot, .square {
    height: 10px;
    width: 10px;
    border: none;
    display: inline-block;
    margin-right: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    vertical-align: middle;
    flex-shrink: 0;
}

.dot {
    border-radius: 100%;
}

.square {
    border-radius: 2px;
}

.calendar table td .model-box:hover .dot,
.calendar table td .model-box:hover .square {
    transform: scale(1.2);
}

/* ============================================
   Task Count Badge (NEW!)
   ============================================ */
.calendar table td .task-count {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e9ecef !important;
    color: #6c757d !important;
    font-size: 0.7em;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    border: 1px solid #dee2e6;
    z-index: 10;
    line-height: 1.2;
    opacity: 0.85;
}

.calendar table td.today .task-count {
    background: #fff3e0 !important;
    color: #f57c00 !important;
    border: 1px solid #ffe0b2;
    opacity: 1;
    font-weight: 600;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Overdue indicator */
.calendar table td.has-overdue {
    border-color: #dc3545 !important;
}

.calendar table td.has-overdue .task-count {
    background: #f8d7da !important;
    color: #dc3545 !important;
    border: 1px solid #f5c2c7;
    opacity: 1;
    font-weight: 600;
}

@keyframes pulse-overdue {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
    }
    50% {
        box-shadow: 0 4px 16px rgba(220, 53, 69, 0.6);
    }
}

/* ============================================
   Empty State
   ============================================ */
.calendar table td .day-box.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ccc;
    font-size: 0.9em;
    font-style: italic;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .calendar table {
        border-spacing: 4px;
    }

    .calendar table td {
        height: 100px;
        padding: 4px;
    }

    .calendar table td .date-box {
        height: 24px;
        width: 24px;
        font-size: 0.85em;
        line-height: 24px;
    }

    .calendar table td .date-box-today {
        height: 32px;
        width: 32px;
        font-size: 1.1em;
        line-height: 32px;
    }

    .calendar table td .model-box {
        top: 36px;
        font-size: 0.75em;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .calendar table td.activity:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }

    .calendar table td.today {
        animation: none;
    }

    .calendar table th div.arrow-prev,
    .calendar table th div.arrow-next {
        display: none;
    }
}
