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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: transparent;
    color: #333;
    line-height: 1.5;
}

.calendar-container {
    width: 100%;
    max-width: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.calendar-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    position: relative;
    overflow: hidden;
}

.calendar-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 10px;
}

.left-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: flex-start;
    min-width: 0;
}

.center-section {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0 5px;
}

.right-section {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

.month-year {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 120px;
    max-width: 180px;
    padding: 0 4px;
}

.english-date-header {
    font-size: 15px;
    font-weight: 700;
    opacity: 0.95;
    /* background: rgba(255, 255, 255, 0.15); */
    padding: 6px 12px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    max-width: 150px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
    flex-shrink: 0;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.current-btn {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.current-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.calendar-grid {
    padding: 20px 24px;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 12px;
}

.weekday {
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.day-cell {
    position: relative;
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f8fafc;
    border: 2px solid transparent;
    padding: 8px 4px;
}

.day-cell:hover {
    background: #e0f2fe;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.day-cell.today {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border-color: #3b82f6;
}

.day-cell.today:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.tithi {
    position: absolute;
    font-size: 10px;
    color: #8d8d8d;
    top: 5px;
}

.day-number {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 4px;
}

.english-date {
    position: absolute;
    bottom: 6px;
    right: 6px;
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
}

.day-cell.today .english-date {
    /* background: rgba(255, 255, 255, 0.2); */
    color: rgba(255, 255, 255, 0.9);
}

.event-indicator {
    position: absolute;
    bottom: 6px;
    right: none;
    width: 6px;
    height: 6px;
    background: #6db3dc;
    border-radius: 50%;
}

.tithi-indicator {
    position: absolute;
    bottom: 25px;
    right: 10px;
    font-size: 14px;
}

.event-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: white;
    color: #333;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    min-width: 240px;
    max-width: 280px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    border: 1px solid #e2e8f0;
}

.event-popup::after {
    content: '';
    position: absolute;
    top: var(--arrow-position, 100%);
    left: var(--arrow-offset, 50%);
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: var(--arrow-color, white transparent transparent transparent);
}

/* Adjust arrow position based on popup placement */
.event-popup[style*="top: 100%"]::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent white transparent;
}

.day-cell:hover .event-popup {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-6px);
}

.event-title {
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 6px;
    font-size: 14px;
}

.event-time {
    color: #64748b;
    font-size: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.event-time i {
    font-size: 11px;
}

.event-desc {
    color: #475569;
    font-size: 13px;
    line-height: 1.4;
}

.day-cell.empty {
    background: transparent;
    border: 2px dashed #e2e8f0;
    cursor: default;
}

.day-cell.empty:hover {
    background: transparent;
    transform: none;
    box-shadow: none;
}

.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Animation for calendar cells */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.day-cell {
    animation: fadeIn 0.3s ease forwards;
    animation-delay: calc(var(--cell-index) * 0.02s);
}

/* Responsive Design - Always single line */
@media (max-width: 1024px) {
    .calendar-header {
        padding: 14px 16px;
    }
    
    .month-year {
        font-size: 18px;
        min-width: 110px;
        max-width: 160px;
    }
    
    .english-date-header {
        font-size: 15px;
        padding: 5px 10px;
        max-width: 130px;
    }
    
    .nav-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .current-btn {
        padding: 7px 14px;
        font-size: 12px;
    }
    
    .header-top-row {
        gap: 8px;
    }
    
    .left-section {
        gap: 4px;
    }

    .calendar-container {
        box-shadow: none;
    }

    .day-number {
        font-size: 25px;
    }
}

@media (max-width: 768px) {
    .calendar-header {
        padding: 12px 14px;
    }
    
    .month-year {
        font-size: 16px;
        min-width: 100px;
        max-width: 140px;
    }
    
    .english-date-header {
        font-size: 14px;
        padding: 4px 8px;
        max-width: 110px;
    }
    
    .nav-btn {
        width: 30px;
        height: 30px;
        font-size: 11px;
    }
    
    .current-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .header-top-row {
        gap: 6px;
    }
    
    .left-section {
        gap: 3px;
    }
    
    .calendar-container {
        border-radius: 12px;
    }
    
    .calendar-grid {
        padding: 16px;
    }
    
    .day-cell {
        height: 70px;
    }

    .tithi {
        font-size: 9px;
        top: 2px;
    }
    
    .day-number {
        font-size: 20px;
    }
    
    .english-date {
        font-size: 10px;
        padding: 1px 4px;
    }

    .tithi-indicator {
        bottom: 22px;
        right: 8px;
        font-size: 12px;
    }
    
    .event-popup {
        min-width: 200px;
        max-width: 240px;
        padding: 12px;
    }
}

@media (max-width: 640px) {
    .calendar-header {
        padding: 10px 12px;
    }
    
    .month-year {
        font-size: 16px;
        min-width: 90px;
        max-width: 120px;
    }
    
    .english-date-header {
        font-size: 12px;
        padding: 3px 6px;
        max-width: 100px;
    }

    .calendar-grid {
        padding: 8px;
    }

    .day-cell {
        height: 58px;
    }

    .weekdays {
        margin-bottom: 9px;
        padding-bottom: 5px;
    }

    .weekday {
        padding: 3px 0;
    }

    .tithi {
        font-size: 8px;
        top: 3px;
    }

    .day-number {
        font-size: 18px;
        margin-bottom: 0px;
    }

    .english-date {
        background: none;
        font-size: 8px;
        padding: 0px 0px;
        bottom: 0px;
        right: 5px;
    }

    .event-indicator {
        bottom: 2px;
        right: none;
    }

    .tithi-indicator {
        position: absolute;
        bottom: 12px;
        right: 3px;
        font-size: 9px;
    }
    
    .nav-btn {
        width: 28px;
        height: 28px;
        font-size: 10px;
    }
    
    .current-btn {
        padding: 5px 10px;
        font-size: 10px;
        gap: 4px;
    }
    
    .current-btn i {
        font-size: 10px;
    }
    
    .header-top-row {
        gap: 4px;
    }
    
    .left-section {
        gap: 2px;
    }
}

@media (max-width: 480px) {
    .calendar-header {
        padding: 8px 10px;
    }
    
    .month-year {
        font-size: 16px;
        min-width: 80px;
        max-width: 100px;
    }
    
    .english-date-header {
        font-size:10px;
        padding: 3px 5px;
        max-width: 90px;
    }

    .tithi {
        font-size: 7px;
        top: 0px;
    }

    .english-date {
        right: 3px;
    }

    .day-cell {
        height: 40px;
    }

    .tithi-indicator {
        bottom: 13px;
        right: 1px;
        font-size: 7px;
    }
    
    .nav-btn {
        width: 26px;
        height: 26px;
        font-size: 9px;
    }
    
    .current-btn {
        padding: 4px 8px;
        font-size: 9px;
    }
    
    .center-section {
        margin: 0 0 0 50px;
    }
}

@media (max-width: 360px) {
    .calendar-header {
        padding: 8px 8px;
    }
    
    .month-year {
        font-size: 15px;
        min-width: 70px;
        max-width: 90px;
    }
    
    .english-date-header {
        font-size: 10px;
        padding: 2px 4px;
        max-width: 80px;
    }

    .calendar-grid {
        padding: 0px;
    }

    .day-cell {
        height: 40px;
        border-radius: 9px;
    }

    .weekdays {
        margin-bottom: 2px;
        background: rgb(247, 247, 247);
        padding: 0px 0px;
    }

    .weekday {
        padding: 3px 0;
    }

    .event-indicator {
        bottom: 3px;
        right: none;
        width: 5px;
        height: 5px;
    }

    .tithi-indicator {
        bottom: 13px;
        right: 0px;
        font-size: 7px;
    }

    .calendar-days {
        gap: 2px;
    }

    .day-number {
        font-weight: 500;
        margin-bottom: 2px;
    }

    .english-date {
        background: none;
        font-size: 8px;
        padding: 0px 0px;
        bottom: 0px;
        right: 2px;
    }
    
    .nav-btn {
        width: 24px;
        height: 24px;
        font-size: 8px;
    }
    
    .current-btn {
        padding: 3px 6px;
        font-size: 8px;
    }
    
    .header-top-row {
        gap: 2px;
    }
}