.month-nav {
    background: none;
    border: none;
    color: #4CAF50;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.month-nav:hover {
    background-color: rgba(76, 175, 80, 0.1);
    transform: scale(1.1);
}

.month-nav:active {
    transform: scale(0.95);
}

.month-nav i {
    font-size: 1rem;
}

/* Mobile View Styles */
@media (max-width: 768px) {
    .heatmap, .months {
        display: none !important;
    }

    .top-row {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    #habit-controls {
        width: 100%;
        order: 1;
    }

    #add-habit {
        width: 100%;
        margin-bottom: 1rem;
    }

    #daily-quote {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 1rem;
        text-align: left;
        border-right: none;
        border-left: 3px solid #4CAF50;
        background-color: rgba(47, 49, 54, 0.6);
        border-radius: 5px;
        order: 2; /* Place quote second */
        box-sizing: border-box;
    }

    #daily-quote span {
        display: block;
        margin-bottom: 0.5rem;
        line-height: 1.5;
    }

    #daily-quote a {
        display: inline-block;
        margin-top: 0.5rem;
    }

    /* Ensure add habit form is full width */
    #new-habit {
        width: 100%;
    }

    #add-habit button {
        width: 100%;
        margin-top: 0.5rem;
    }

    .mobile-month-view {
        margin: 1rem 0;
        background-color: #1a1b1e;
        border-radius: 8px;
        padding: 1rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-month-view .month-nav {
        width: 28px;
        height: 28px;
    }

    .mobile-month-view .month-nav i {
        font-size: 0.9rem;
    }

    .mobile-calendar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.5rem;
        margin-bottom: 1rem;
        width: 100%;
    }

    .mobile-calendar-header .current-month {
        flex: 1;
        text-align: center;
        font-size: 1.1rem;
        font-weight: 500;
        color: #ffffff;
        padding: 0 0.5rem;
        margin: 0;
        white-space: nowrap;
    }

    .mobile-calendar-header .month-nav {
        flex: 0 0 32px;
        width: 32px;
        height: 32px;
        padding: 0;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: #4CAF50;
        border-radius: 50%;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-calendar-header .month-nav i {
        font-size: 0.9rem;
    }

    .month-nav {
        background: none;
        border: none;
        color: #4CAF50;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        border-radius: 50%;
        transition: background-color 0.2s;
        -webkit-tap-highlight-color: transparent;
    }

    .month-nav:active {
        background-color: rgba(76, 175, 80, 0.2);
    }

    .month-nav:hover {
        background-color: rgba(76, 175, 80, 0.1);
    }

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

    .weekday {
        text-align: center;
        font-size: 0.75rem;
        color: #888;
        padding: 0.5rem 0;
    }

    .day {
        aspect-ratio: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
        border-radius: 4px;
        cursor: pointer;
        position: relative;
        background-color: #2a2b2e;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .day.empty {
        background-color: transparent;
        cursor: default;
    }

    .day.checked {
        background-color: var(--day-color, #4CAF50);
        color: white;
    }

    .day.today {
        border: 2px solid #4CAF50;
    }

    .day.has-note::after {
        content: '';
        position: absolute;
        top: 2px;
        right: 2px;
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background-color: #3498db;
    }

    .day:not(.empty):hover {
        background-color: rgba(76, 175, 80, 0.2);
    }

    /* Adjust existing components for mobile */
    .habit {
        margin-bottom: 1.5rem;
    }

    .habit-info {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem;
        gap: 1rem;
    }

    .habit-name-and-tags {
        flex: 1;
        min-width: 0; /* This prevents flex items from overflowing */
    }

    .habit-name {
        font-size: 1.7rem;
        margin-bottom: 0.25rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .habit-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .habit-actions {
        display: flex;
        align-items: center;
        gap: 1rem;
        flex-shrink: 0; /* Prevent actions from shrinking */
    }

    .habit-actions i {
        font-size: 1.1rem;
        padding: 0.5rem;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .edit-habit {
        color: #4CAF50;
    }

    .delete-habit {
        color: #ff4d4d;
    }

    .edit-habit:hover,
    .delete-habit:hover {
        transform: scale(1.1);
    }

    .habit-actions i {
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
    }


    .edit-habit:hover {
        background-color: rgba(76, 175, 80, 0.1);
    }

    .delete-habit:hover {
        background-color: rgba(255, 77, 77, 0.1);
    }


    .habit-stats {
        flex-direction: column;
        padding: 1rem;
    }

    .stats-info {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        width: 100%;
    }

    .stats-actions {
        width: 100%;
        justify-content: space-between;
        margin-top: 1rem;
    }
}

/* Desktop Calendar View Styles */
@media (min-width: 769px) {
    .calendar-view {
        background-color: rgba(47, 49, 54, 0.6);
        border-radius: 8px;
        padding: 2rem;
        margin: 1rem 0;
        max-width: 800px; /* Limit maximum width */
        margin-left: auto;
        margin-right: auto;
    }

    .calendar-view .calendar-header {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .calendar-view .current-month {
        min-width: 200px;
        text-align: center;
        font-size: 1.2rem;
        font-weight: 500;
        color: #ffffff;
        padding: 0.5rem 1rem;
        background-color: rgba(76, 175, 80, 0.1);
        border-radius: 4px;
        border: 1px solid rgba(76, 175, 80, 0.2);
    }

    .calendar-view .calendar-grid {
        display: grid;
        grid-template-columns: repeat(7, minmax(80px, 1fr));
        gap: 8px;
        width: 100%;
        max-width: 700px; /* Limit grid width */
        margin: 0 auto;
    }

    .calendar-view .weekday {
        text-align: center;
        font-size: 0.875rem;
        color: #888;
        padding: 0.5rem 0;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .calendar-view .day {
        aspect-ratio: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
        border-radius: 8px;
        background-color: #2a2b2e;
        cursor: pointer;
        position: relative;
        transition: all 0.2s ease;
        border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .calendar-view .day:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        background-color: #32333a;
    }

    .calendar-view .day.empty {
        background-color: transparent;
        border: none;
        cursor: default;
    }

    .calendar-view .day.empty:hover {
        transform: none;
        box-shadow: none;
    }

    .calendar-view .day.checked {
        background-color: var(--day-color, #4CAF50);
        color: white;
        border: none;
    }

    .calendar-view .day.today {
        border: 2px solid #4CAF50;
        font-weight: bold;
    }

    .calendar-view .day.has-note::after {
        content: '';
        position: absolute;
        top: 4px;
        right: 4px;
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background-color: #3498db;
        box-shadow: 0 0 4px rgba(52, 152, 219, 0.5);
    }

    /* Add a subtle grid pattern */
    .calendar-view {
        background-image: 
            linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
        background-size: 20px 20px;
        background-position: -1px -1px;
    }
}