@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
    background-color: #f4f4f5; /* zinc-100 */
}

#app {
    padding-bottom: 80px; /* Space for the navbar */
}

@media (min-width: 1024px) {
    #app {
        padding-bottom: 0;
    }
}

.calendar-grid, .year-grid {
    display: grid;
}

.calendar-grid {
    grid-template-columns: repeat(7, 1fr);
}

.year-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.day-cell, .month-cell {
    transition: all 0.2s ease-in-out;
    position: relative;
}

.day-cell:active, .month-cell:active {
    transform: scale(0.95);
}

.day-cell.selected {
    transform: scale(1.08);
    box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.4);
    background-image: linear-gradient(to top right, #3b82f6, #60a5fa);
    color: white;
}

.day-cell.selected .lunar-day, .day-cell.selected .text-red-500, .day-cell.selected .text-purple-500 {
    color: rgba(255, 255, 255, 0.8) !important;
}

.day-cell.selected .dots-container .dot.user {
    background-color: white !important;
}

.hoang-dao-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.nav-item.active svg, .nav-item.active span {
    color: #3b82f6; /* blue-500 */
}

.nav-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.view-switcher-btn {
    position: relative;
}

.view-switcher-btn.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background-color: #3b82f6;
    border-radius: 50%;
}

.tooltip {
    position: absolute;
    background-color: #1f2937; /* gray-800 */
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 12px;
    white-space: normal;
    z-index: 9999;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    max-width: 280px;
    min-width: 200px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Default position (top) - applied when no specific position class is set */
.tooltip:not(.tooltip-bottom):not(.tooltip-left):not(.tooltip-right) {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
}

/* Default position (top) */
.tooltip.tooltip-top {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
}

/* Bottom position */
.tooltip.tooltip-bottom {
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
}

/* Left position */
.tooltip.tooltip-left {
    right: 100%;
    top: 50%;
    transform: translateX(-8px) translateY(-50%);
}

/* Right position */
.tooltip.tooltip-right {
    left: 100%;
    top: 50%;
    transform: translateX(8px) translateY(-50%);
}

/* Additional adjustments for edge cases */
.tooltip.tooltip-top.tooltip-adjust-left {
    left: 0;
    transform: translateX(0) translateY(-8px);
}

.tooltip.tooltip-top.tooltip-adjust-right {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(-8px);
}

.tooltip.tooltip-bottom.tooltip-adjust-left {
    left: 0;
    transform: translateX(0) translateY(8px);
}

.tooltip.tooltip-bottom.tooltip-adjust-right {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(8px);
}

/* Tooltip visibility is now controlled by JavaScript */
.tooltip {
    transition: opacity 0.2s, visibility 0.2s;
}

/* Mobile optimizations for tooltip */
@media (max-width: 768px) {
    .tooltip {
        max-width: 250px;
        min-width: 180px;
        font-size: 11px;
        padding: 10px 12px;
    }

    /* On mobile, prefer bottom position to avoid keyboard issues */
    .tooltip.tooltip-top {
        bottom: auto;
        top: 100%;
        transform: translateX(-50%) translateY(8px);
    }
}

/* Disable tooltip on touch devices to avoid conflicts */
@media (hover: none) {
    .tooltip {
        display: none !important;
    }
}

.day-cell.weekend {
    background-color: #f8fafc; /* slate-50 */
}

.day-cell.today .solar-day {
    position: relative;
}

.day-cell.today .solar-day::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 34px;
    height: 34px;
    border: 2px solid #3b82f6;
    border-radius: 50%;
    z-index: -1;
}

.day-cell.today.selected .solar-day::after {
    border-color: transparent; /* Hide ring when selected */
}

.month-cell:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dots-container {
    position: absolute;
    bottom: 4px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1px;
}

.dots-container .dot {
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

/* Mobile responsive fixes for dots container */
@media (max-width: 768px) {
    .dots-container {
        bottom: 4px;
        gap: 0.5px;
        max-width: calc(100% - 4px);
        left: 4px;
        right: 4px;
    }

    .dots-container .dot {
        width: 4px;
        height: 4px;
        min-width: 4px;
        min-height: 4px;
    }

    /* Ensure dots don't overflow on very small screens */
    .day-cell {
        overflow: hidden;
        position: relative;
    }

    /* Reduce gap between dots on very small screens */
    @media (max-width: 480px) {
        .dots-container {
            gap: 0.75px;
        }

        .dots-container .dot {
            width: 3.5px;
            height: 3.5px;
            min-width: 3.5px;
            min-height: 3.5px;
        }
    }

    /* Ensure calendar grid cells maintain proper aspect ratio on mobile */
    .calendar-grid {
        gap: 0.5rem;
    }

    /* Adjust day cell padding on mobile */
    .day-cell {
        padding: 0.25rem !important;
    }

    /* Ensure lunar day text doesn't interfere with dots */
    .lunar-day {
        line-height: 1;
        margin-bottom: 2px;
    }

    /* Ensure solar day text is properly sized */
    .solar-day {
        font-size: 0.875rem !important;
        line-height: 1;
    }
}

/* Ensure dots are visible on weekend days */
.day-cell.weekend .dots-container {
    z-index: 1;
}

/* Ensure dots are visible when day is selected */
.day-cell.selected .dots-container {
    z-index: 2;
}

.dot.holiday {
    background-color: #d75555;
}

.dot.user {
    background-color: #3b82f6;
}

.dot.moon {
    background-color: #f97316;
}

/* blue-500 */

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

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: .2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin .75s linear infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Modal confirm đăng nhập */
#login-confirm-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
}

#login-confirm-modal .modal-content {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    max-width: 90vw;
    min-width: 300px;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.15);
    text-align: center;
}

#login-confirm-modal .modal-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}